Just a second...

Handling clients

Interacting with clients from within a publisher

A publisher is notified when a client subscribes to one of its topics through the subscription method and when the client unsubscribes the unsubscription method is called.

A publisher can receive message from clients and send messages to clients (see below).

A client can request the state of any topic or topics at any time even if not subscribed to it. This is referred to as 'fetch' request. Such a request can routed to the publisher's fetchForClient method if a topic has no topic data.

Other than the above, a publisher is not normally notified of any other client activity. However a publisher can choose to receive client notifications using the Publishers.addEventListener method. Using client notifications, a publisher can even handle a fetch request for a topic that does not exist and return a reply (using Client.sendFetchReply) without the overhead of actually creating a topic.

A publisher can also choose to close or abort clients.

Sending and receiving client messages

In addition to publishing messages to all clients subscribed to a topic, you can send a message to only a single client using the Client.send method.

A client can also send messages to the publisher and these are received on the messageFromClient method which handles them accordingly. Only implement this method if messages are expected from clients. Alternatively the publisher specifies topic listeners to handle the messages on a per topic basis.

The message is mapped to a delta TopicMessage.