com.streamhub.api
Interface Publisher

All Known Subinterfaces:
PushServer
All Known Implementing Classes:
NIOServer, SecureNIOServer

public interface Publisher

A Publisher allows you to publish to all subscribed clients on a particular topic. Only clients who are connected and subscribed to topic will receive the payload.


Method Summary
 void publish(String topic, Payload payload)
          Sends the payload to all clients who are subscribed to topic.
 

Method Detail

publish

void publish(String topic,
             Payload payload)
Sends the payload to all clients who are subscribed to topic. Only connected clients who are subscribed to topic will receive the payload. This interface is implemented by NIOServer.

This method should generally be preferred over Client.send(String, Payload) except where unique information must be sent to each client.

StreamHub keeps its own internal map of subscriptions. If you need to send something on a topic which a client has not subscribed to, use Client.send(String, Payload).

Parameters:
topic - the topic on which to send the message
payload - the message payload
See Also:
Payload


Copyright © 2009 StreamHub. Tutorials, news and guides can be found on the StreamHub Comet Blog.