Design

The most important activity performed by the chat application is the distribution of chat room updates, including events such as Emma joined the room or Michael sent the message 'Hello!'.
 


The chat server can use callbacks to deliver these updates to a chat client. The disadvantage of relying solely on callbacks as the means for delivering chat updates is that chat clients must be written in a language for which Ice supports server-side activities. For example, in order to write a web-based chat client we can use JavaScript or PHP, but the PHP language mapping does not include a server-side run time.

To accommodate the varying capabilities of the client language mappings, our design supports two separate delivery models: push and pull. The push model delivers updates using callbacks, therefore a client using this model simply waits passively for the chat server to notify it about new events. In contrast, the pull model requires the client to actively poll periodically in order to receive new updates.
 


The push model is preferred because it scales better, so we will use it for the clients whose language mapping supports a server-side run time (C++, C#, Java, JavaScript, Objective-C and Python). The pull model is the only option for our PHP client.