|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Client
A Bayeux Client.
A client may subscribe to channels and publish messages to channels.
Client instances should not be directly created by uses, but should
be obtained via the Bayeux.getClient(String)
or Bayeux#newClient(String, Receiver)
methods.
Three types of client may be represented by this interface:
Method Summary | |
---|---|
void |
deliver(Client from,
Map<String,Object> message)
Deliver a message to this client only Deliver a message directly to the client. |
void |
endBatch()
End a batch of messages. |
String |
getId()
|
Listener |
getListener()
|
boolean |
hasMessages()
|
boolean |
isLocal()
|
void |
publish(String toChannel,
Object data,
String msgId)
Publish data from this client. |
void |
remove(boolean timeout)
Remove Client Unsubscribe client from all channels and remove it. |
void |
setListener(Listener listener)
|
void |
startBatch()
Start a batch of messages. |
void |
subscribe(String toChannel)
Subscribe this client to a channel. |
List<Map<String,Object>> |
takeMessages()
Take any messages queued for a client. |
void |
unsubscribe(String toChannel)
Unsubscribe this client from a channel. |
Method Detail |
---|
String getId()
void publish(String toChannel, Object data, String msgId)
Bayeux.publish(Client, String, Object, String)
with this client passed
as the fromClient.
data
- The data itself which must be an Object that can be encoded with JSON
.toChannel
- The Channel ID to which the data is targettedmsgId
- optional message ID or null for automatic generation of a message ID.void subscribe(String toChannel)
Bayeux.subscribe(String, Client)
with this client passed.
Equivalent to getChannel(toChannel).subscribe(subscriber).
toChannel
- void unsubscribe(String toChannel)
Bayeux.unsubscribe(String, Client)
with this client passed.
toChannel
- void remove(boolean timeout)
timeout
- boolean hasMessages()
List<Map<String,Object>> takeMessages()
void deliver(Client from, Map<String,Object> message)
from
- The Client that published the message, or null if not known/availablemessage
- void setListener(Listener listener)
Listener getListener()
boolean isLocal()
void startBatch()
void endBatch()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |