To run the Chat Demo application, do the following steps on each participating machine:
The Chat program displays a simple chat UI (an instance of class ChatFrame), and the program exports a chat object (an instance of class Chat) that implements interface ChatRef. Each chat room is associated with its own multihandle for interface ChatRef, and the chat object is attached to the multihandle corresponding to the chat room the user joined. When the user sends a line of text in the UI, the line is broadcast to all the chat objects in the chat room by calling putLine() on the multihandle. When each chat object receives a putLine() invocation, it displays the line of text in the chat log in its UI.
To discover which chat rooms are out there, the chat object also implements interface ChatDiscoveryRef. Each chat object periodically broadcasts the name and multihandle of its chat room by calling reportChatRoom() on an omnihandle for interface ChatDiscoveryRef. When each chat object receives a reportChatRoom() invocation, it puts the chat room name and multihandle in a list. When the user selects a chat room, the chat object detaches itself from the previous chat room's multihandle and attaches itself to the new chat room's multihandle.