What's new? | Help | Directory | Sign in
Google
                
Search
for
Updated Oct 06, 2008 by dburkes
LingrJS  

Lingr JS

lingr.js is a fully-functional Lingr API client written in Javascript. It uses dynamic script tags to communicate with the Lingr servers, and calls your registered event handlers when interesting things happen (e.g., the room roster changes, someone says something, etc.).

lingrtest.html provides a sample usage. Details of the options parameter to the Lingr constructor are as follows:

Configuration Options

optionrequired?meaningdefault value
apiKeysee belowA session id, if you have already created onenone
sessionsee belowThe Lingr API key to usenone
ticketsee belowA room ticket, if you have already created onenone
roomIdyesThe room to enternone
dsrTimeoutnoTimeout value for dynamic script tag-based API calls, in milliseconds90000
clientTypenoThe type of client you wish to appear ashuman
nicknamenoThe nickname for this chatter. If not provided, the chatter is an anonymous observernone
emailnoIf provided, along with password, the session is authenticated to the indicated user before entering the roomnone
passwordnoIf provided, along with email, the session is authenticated to the indicated user before entering the roomnone
contextLinesnoIf provided, the indicated number of past messages are delivered to the onMessagesReceived handler upon entering the roomnone
userMessagesOnlynoIf true, only user and private messages are delivered to the onMessagesReceived handler none

At least one of apiKey, session, or ticket must be provided.

Event Handlers

handler nameusage
onSessionCreatedcalled after an API session is created
onSessionDestroyedcalled after an API session is destroyed
onSessionAuthenticatedcalled after an API session is authenticated
onRoomEnteredcalled after an the room is entered
onRosterUpdatedcalled when a roster updated is received
onMessagesReceivedcalled after messages are received
onRoomExitedcalled after the room is exited
onApiFailurecalled when any API call returns status "fail"

If you develop a site or tool using lingr.js, please let us know by adding your creation to the Showcase page !!