RealChat can be used directly with popular Bulletin Board and Content Management systems. Simply download the appropriate file and install it using the included instructions:
If your bulletin board or content management system is not listed, the following topics will help you to integrate
RealChat with any existing system.
RealChat can be easily integrated with an existing user profile or membership, database. RealChat chat urls can contain additional parameters which send additional information to the chat client. These additional parameters allow your users to skip the login screen. You attach these parameters to the standard chat urls generated within the Control Center. Parameters can be added using any server side language. ASP, PHP, and Perl are common choices, but you may use whatever you are comfortable with or whatever your existing website is written in.
The parameters are attached to the chat urls as follows:
http://chathost:port/?0,0,0,0,0¶m1=value1¶m2=value2
Available parameters include:
nnnickname, URL-encoded
puprofile URL
auavatar URL
rproom password (if the room specified in the link is password-protected)
cuclose URL - the url to be opened after the client exits the chat session.
hmacmessage authentication code (see below)
For example, to directly login a user with the nickname John, you would use:
http://chathost:port/?0,0,0,0,0&nn=John
All parameters need to be passed URL-encoded.
To prevent people from calling the client with fake user data, we strongly recommend that you enable HMAC-based
client-server authentication. This is done from the Server Settings section of the Control Center.
The HMAC protection works this way:
1. A secret string is generated on the server side (the client authentication key).
2. The key is made available to the membership database scripts (PHP, ASP, ...).
3. The scripts now generate a unique code for each user.
The code is generated as follows:
md5( cpID + nickName + profileURL + avatarURL + authKey + date )
cpIDis the desired client profile ID.
nickNameis the desired username, URL-encoded.
profileURLis the desired profile URL.
avatarURLis the desired avatar URL.
dateis the current date in YYYYMMDD format (e.g. 20070126).
authenticationKeycorresponds to the Authentication Key set on server side.
4. Pass the dynamically generated code to the server by setting the hmac parameter of the chat client.
5. Upon receiving a connection request, the chat server also calculates the same hash code and verifies the login
details by comparing the result to the string the client sent.
The following is a PHP code example which implements the method described above:
<?php
/**
* Nickname, avatar and profile URLs.
* These are usually pulled from the database.
*/
$nickName = rawurlencode("test"); // rawurlencode is important
$profileURL = rawurlencode("http://www.example.com/");
$avatarURL = rawurlencode("http://www.example.com/avatar.jpg");
/**
* This string must match the Authentication Key, that you
* specified in the RealChat Control Center, Server Settings.
*/
$authKey = "KUASRDJMLBVVVPKR";
/**
* Valid chat launching link generated with the Control Center.
*/
$link = "http://chathost:port/?0,0,0,0,0";
/**
* Generates a HMAC-protected link, based on the source link,
* username, avatar and profile URLS, and authKey.
*/
function HMACLink($nickName, $profileURL, $avatarURL, $link, $authKey) {
$cpID = substr(strrchr($link, ','), 1);
$hmac = md5($cpID.$nickName.$profileURL.$avatarURL.$authKey.date('Ymd'));
return $link."&nn=".$nickName."&pu=".$profileURL."&au=".$avatarURL."&hmac=".$hmac;
}
/**
* The dedicated chat URL for this user.
* It should be used for Chat Now buttons, etc.
*/
$hmacLink = HMACLink( $nickName, $profileURL, $avatarURL, $link, $authKey );
// a test
echo '<a href="'.$hmacLink.'">Chat Now!</a>';
?>