Html5 chat has now a new mode : the “messenger” mode
What is the messenger mode chat like ?
The messenger mode like has these features:
- it embeds inside an existing website
- the page is not exclusive to the chat. In fact chats inserts inside the page
- it is one to one chat only, with exclusive video/audio calls when you can choose users between list of connected users and users who already sent you messages: it works with online and offline users
- when user or you change the page, all chats are restores. So it is suitable with any websites, including websites that are not Single Application Pages
How to set up the messenger mode on my site ?
Go to chat admin and choose “Messenger mode”
Make sure you add the script to ANY page where you want the script to be present. A good technique is to use a common page to all you site like inside footer.php
Replace webmasterid and token by your webmasterid and your token. You can find that inside your chatadmin panel
How to pass user parameters to the chat ?
If you just use the script like, you user is not identified by the chat: he will need to input his username and will be assigned a random id and random avatar.
If you want to specify an username, id and avatar, you need to pass some extra parameters to the script. Use JWT to encode these parameters and pass them to the chat as shown in this sample:
<?php $json = json_encode(array( 'id' =>xxx, 'username' =>'yourUsername', 'password' =>'password of your html5-chat account', 'avatar' =>'https://html5-chat.com/img/malecostume.svg' )); $encoded = file_get_contents("https://jwt.html5-chat.com/protect/".base64_encode($json)); ?>
- xxx is an unique id user
- username : is an unique username for user
- password: is your html5 chat password account
- avatar is the url of the user avatar
You should test the demo, with 2 browsers.