|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Client
A Bayeux Client.
A Client instance represents a consumer/producer of messages in bayeux. 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)
methods.
Two types of client may be represented by this interface:
Method Summary | |
---|---|
void |
addExtension(Extension ext)
Adds a bayeux client extension. |
void |
addListener(ClientListener listener)
Adds a listener. |
void |
deliver(Client from,
java.lang.String toChannel,
java.lang.Object data,
java.lang.String id)
Delivers a message to the remote client represented by this object. |
void |
disconnect()
Disconnects this Client from the server. |
void |
endBatch()
Ends a batch of messages. |
java.lang.String |
getId()
|
int |
getMaxQueue()
|
java.util.Queue<Message> |
getQueue()
|
boolean |
hasMessages()
|
boolean |
isLocal()
|
void |
removeExtension(Extension ext)
Removes a bayeux client extension. |
void |
removeListener(ClientListener listener)
Removes a listener |
void |
setMaxQueue(int max)
|
void |
startBatch()
Starts a batch of messages. |
java.util.List<Message> |
takeMessages()
Deprecated. use addListener(ClientListener) to be notified of messages |
Method Detail |
---|
java.lang.String getId()
boolean hasMessages()
java.util.List<Message> takeMessages()
addListener(ClientListener)
to be notified of messages
void deliver(Client from, java.lang.String toChannel, java.lang.Object data, java.lang.String id)
from
- the Client that sends the messagetoChannel
- the channel onto which the message is sentdata
- the data of the messageid
- the message IDvoid addExtension(Extension ext)
ext
- the extension to addremoveExtension(Extension)
void removeExtension(Extension ext)
ext
- the extension to remove��addExtension(Extension)
void addListener(ClientListener listener)
listener
- the listener to addremoveListener(ClientListener)
void removeListener(ClientListener listener)
listener
- the listener to removeaddListener(ClientListener)
boolean isLocal()
void startBatch()
endBatch()
is called.
Batches may be nested and messages are only sent once all batches are ended.
endBatch()
void endBatch()
startBatch()
is called.
Batches may be nested and messages are only sent once all batches are ended.
startBatch()
void disconnect()
java.util.Queue<Message> getQueue()
void setMaxQueue(int max)
max
- The size which if a client queue exceeds, forces a call to
QueueListener.queueMaxed(Client, Client, Message)
to check if the message should be added.
If set to -1, there is no queue limit. If set to zero, messages are not queued.getMaxQueue()
int getMaxQueue()
setMaxQueue(int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |