General Information
There is a set of commands that you can use to communicate with RealChat Client applet and spice up your chat room. You access these commands using JavaScript embedded in your client HTML pages. You may take a look at Example 3 for an idea of what you can do with the API commands.
Note: RealChat Client API functions are available only in the Enterprise Edition.
How This Works (An Example)
Let's say you have the following code somewhere in your client HTML page:
<script type="text/javascript"> <!-- function join( roomName ) { ChatClient.changeRoom( roomName ); } //--> </script> <applet codebase = "." archive = "RealChat.jar" code = "rcs.client.RealChatClient.class" name = "ChatClient" width = "500" height = "400" MAYSCRIPT> . . </applet> <a href="javascript:join('The Lobby');">Go to The Lobby</a>When users click the Go to The Lobby link, they will enter The Lobby room.
Available Commands
setChatText(message)
Sets the text of the chat input field tomessage
. Note that the chat client will automatically replace the first occurance of the token "_USER_" with the currently selected user name, and the first occurance of the token "_ME_" with the name that the client is currently connected as. The following example shows this command:
ChatClient.setChatText( 'Hi _USER_, how are you doing?' ); ChatClient.setChatText( 'My name is _ME_.' );sendMessage(message)
Same as the above, but will automatically sendmessage
.getSelectedUser()
Returns the currently selected user name. For example:
var selectedUser = ChatClient.getSelectedUser();myName()
Returns the name that the client is currently connected as.getCurrentRoom()
Returns the name of current room.changeRoom(roomName)
Changes the room.alert(header, message)
Displays an alert dialog box with specifiedheader
andmessage
.echo(message)
Appendsmessage
to chat area.logout()
Logs the client out and exits.