Instant messenger integration

Submitted 5/31/2012 by Support

eStreamChat supports 1-to-1 instant messenger mode where users can start a chat directly from your site without having to enter any chat room. The integration consists of two parts that are detailed below. Make sure that your chat installation is configured to use the Remote User Authentication Provider.

1. Adding a script that checks for new chat requests

In this example the check will be implemented in javascript which can be included in any web site. A suitable place to include the script would be in your master page or header component that is loaded for every page. This way a user can receive chat requests regardless of which page they are on.

You can include the above script as is or customize it according to your preferences. Once the script is included in need to initialize it with the data of the currently logged user by calling the Messenger.initialize(...) function. The function parameters are as follows:

chatHomeUrl - the url where eStreamChat is installed

userId - the id (username) of the currently logged user

timestamp - the current timestamp in "yyMMddhhmmss" format

hash - the user id, timestamp and the pre-shared secret key concatenated in this order and then hashed with SHA1

updateOnlineFrequency - how often the script should check for new chat requests (in miliseconds)

Once the script is included and the initialization is added then users can accept chat requests. All that is left is to place "Start Chat" or similar links on the user profile page or wherever is appropriate on your site.

2. Adding chat request links

There are plenty of places where you can add chat links on your site - on the user profile page, on the online users box, on the friends page etc. The messenger link url would look like this: