Protocol subsystem

The Protocol subsystem supports joining and exiting a Taligent Chat discussion and submitting and receiving data. This program takes advantage of the Caucus framework to implement these features.


MChatHandler is a mixin class that defines the interface used by clients of the Taligent Chat protocol. Taligent Chat protocol consists of joining, exiting, and submitting text messages to a Taligent Chat discussion.

MChatHandler also defines a routine for creating an interest that a client connects to when it wants to be notified of incoming text messages. All interested views might want to connect to receive this notification in order to update their views with new information.

In this program, the underlying network communications are hidden from all objects in this program except the TChatHandler object. This object is a concrete implementation of the MChatHandler protocol that uses the Caucus framework. As a subclass of MCaucusMessageHandler, TChatHandler gathers caucus messages and parses them. For example, TChatView calls the MChatHandler member functions to send messages across the network to a Taligent Chat discussion. This design allows you to take advantage of network communications outside of those provided by the Caucus framework.

The sending portion of the Taligent Chat protocol is defined in MChatHandler. On the receiving side, MChatHandler receives and processes incoming messages. It also sends out the notification with the incoming text.

This program instantiates TCaucusReadThread which reads messages from a caucus in a separate thread. The read thread does not exist when a document is first opened. TChatHandler instantiates the read thread when the user hits the Join button and destroys the read thread when the user leaves a Taligent Chat discussion. TCaucusReadThread takes an MCaucusMessageHandler to call member functions that handle caucus events (such as receiving a data message).

MCaucusMessageHandler works in conjunction with TCaucusReadThread and defines callback protocol that it uses with the caucus read thread. Because this program passes an alias to a MCaucusMessageHandler object to handle the callbacks, the thread is in the same task address space as the creator of the object.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker