|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface MessageDispatcher
Message dispatcher is responsible for collecting all outbound messages and sending them in thread safe way.
The idea of dispatcher is to guarantee that no matter from how many threads will send message by
MessageSender implementations,
those messages will be redirected to dispatcher and dispatcher maintains sending them to jwebsocket server.
Implementations must be able to send single targeted message or broadcasting messages.
Dispatchers should not perform filtering or any extra operations related with choosing sending target.
Only one instance of dispatcher is created at plugin start.
Any new threads used by dispatcher should be interrupted in stopDispatching() method.
In future versions, messages will contain priority, so dispatcher will be able to sort messages into more and less important.
In addition, future versions will be able to make use of configuration file, for example, to specify interval of message dispatching.
| Method Summary | |
|---|---|
void |
addMessage(WebSocketMessage message)
Adds message containing token and one or more target connectors. |
void |
dispatchMessages()
Dispatches collected messages and removing them from collection. |
void |
setServer(org.jwebsocket.api.WebSocketServer server)
Sets server implementing jwebsocket framework server interface. |
void |
startDispatching()
Describes operations, like dispatcher thread start, which will be invoked when framework will be ready for sending messages. |
void |
stopDispatching()
Operations executed when framework stops and no messages can be sent anymore. |
| Method Detail |
|---|
void addMessage(WebSocketMessage message)
message - message.
void dispatchMessages()
throws java.lang.Exception
java.lang.Exception - if any exception occurs.void startDispatching()
void stopDispatching()
void setServer(org.jwebsocket.api.WebSocketServer server)
server - jwebsocket server implementation.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||