|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface SubscriptionListener
This interface is used to receive callbacks when a client subscribes or unsubscribes from a topic.
A subscription to a topic is a request to receive streaming data on this topic. For example a subscription to the topic 'MSFT' could represent a request to receive stock quotes on the ticker symbol 'MSFT'.
| Method Summary | |
|---|---|
void |
onSubscribe(String topic,
Client client)
Called when a client subscribes to a topic. |
void |
onUnSubscribe(String topic,
Client client)
Called when a client unsubscribes from a topic. |
| Method Detail |
|---|
void onSubscribe(String topic,
Client client)
It is possible
to return a direct response to the client using
Client.send(String, Payload). This may be used to
return some static data to a client. However, after returning
any static data it is preferable to use NIOServer.publish(String, Payload)
to publish data to every client subscribed to a topic.
topic - The topic the client subscribed toclient - The client who initiated the subscription
void onUnSubscribe(String topic,
Client client)
It is possible to return a response to the client using
Client.send(String, Payload). However, by the time this
method has been called, the client will have been removed from
StreamHubs internal subscription map so any calls to
NIOServer.publish(String, Payload) will not send data to
this client. If for some reason you wish to
still send data to this unsubscribed
client you will need to save the client parameter for later use.
topic - The topic the client unsubscribed fromclient - The client who unsubscribed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||