OrbiterMicro Chat Example

With OrbiterMicro, a basic chat requires only 70 lines of JavaScript, and no server-side code. The chat below is pure JavaScript on an HTML page, with a little CSS for visual appeal. This example is also available for ActionScript (Adobe® Flash®).

[Edit Live on JSFiddle] [Download]

Note: This example uses sendUPC() to send messages to Union Server. The sendUPC() method is required in OrbiterMicro only. For a much broader API for managing communications with Union Server, see Orbiter, Union's full-featured JavaScript framework.

Sending and Receiving Messages

The chat application defines a custom message, named "CHAT_MESSAGE", which clients send and receive. Messages are sent via MessageManager's sendUPC() method and received via MessageManager's addMessageListener() method.

The Code

Here's the code for the chat, including all HTML, CSS, and JavaScript.