Lingr JSlingr.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| option | required? | meaning | default value | | apiKey | see below | A session id, if you have already created one | none | | session | see below | The Lingr API key to use | none | | ticket | see below | A room ticket, if you have already created one | none | | roomId | yes | The room to enter | none | | dsrTimeout | no | Timeout value for dynamic script tag-based API calls, in milliseconds | 90000 | | clientType | no | The type of client you wish to appear as | human | | nickname | no | The nickname for this chatter. If not provided, the chatter is an anonymous observer | none | | email | no | If provided, along with password, the session is authenticated to the indicated user before entering the room | none | | password | no | If provided, along with email, the session is authenticated to the indicated user before entering the room | none | | contextLines | no | If provided, the indicated number of past messages are delivered to the onMessagesReceived handler upon entering the room | none | | userMessagesOnly | no | If 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 name | usage | | onSessionCreated | called after an API session is created | | onSessionDestroyed | called after an API session is destroyed | | onSessionAuthenticated | called after an API session is authenticated | | onRoomEntered | called after an the room is entered | | onRosterUpdated | called when a roster updated is received | | onMessagesReceived | called after messages are received | | onRoomExited | called after the room is exited | | onApiFailure | called 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 !!
|