The entry point for events, such as subscribe(eventName, listener)
, emit(eventName)
and provider functionality such as listen(eventName, listener)
.
Methods
emit(eventName)
void emit(String eventName)
argument | type | description |
---|---|---|
eventName | String | The event name |
Sends the event to all subscribed clients without a payload.
emit(eventName,data)
void emit(String eventName, Object data)
argument | type | description |
---|---|---|
eventName | String | The event name |
data | Object | The data to serialise and send with the event |
Sends the event to all subscribed clients with the given payload.
subscribe(eventName,listener)
void subscribe(String eventName, EventListener EventListener)
argument | type | description |
---|---|---|
eventName | String | The event name |
eventListener | EventListener | The Event Listener |
Subscribes to eventName and notifies the listener via EventListener whenever it occurs locally or remotely.
unsubscribe(eventName,listener)
void unsubscribe(String eventName, EventListener EventListener)
argument | type | description |
---|---|---|
eventName | String | The event name |
eventListener | EventListener | The Event Listener |
Unsubscribes from an event that was previously registered with subscribe()
. This stops a client from receiving the event.
listen(pattern,listener)opensource / enterprise
void listen(String pattern, ListenListener listen)
argument | type | description |
---|---|---|
pattern | String | The pattern to match events which subscription status you want to be informed of |
listener | ListenListener | The Listen Listener |
Registers the client as a listener for event subscriptions made by other clients. This is useful to create active data providers - processes that only send events if clients are actually interested in them. You can find more about listening in the events tutorial.
unlisten(pattern)opensource / enterprise
void unlisten(String pattern)
argument | type | description |
---|---|---|
pattern | String | The pattern that has been previously listened to |
Remove the listener added via listen(pattern,listener)
. This will remove the provider as the active provider and allow another provider to take its place.