Messenger mode

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

<script src='https://html5-chat.com/script/webmasterid/token'></script>

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));
?>
 <script src='https://html5-chat.com/script/webmasterid/$encoded '></script> 
  • 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.

3 thoughts to “Messenger mode”

  1. I have a couple of questions about messenger mode.

    1) It doesn’t seem to show the total number of users online, but instead, if you chatted with someone, the Users total still shows the offline users. If you select the ONLINE ONLY function it does not update the number of users that are online?

    2) If you integrated with the website, can you still open the user profile (as you can in normal chat rooms) if you right click on a user or something like that, and can you still send images in messenger mode?

    Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.