Methods
on(event, handler)
Register an event handler for an event
Parameters:
Name | Type | Description |
---|---|---|
event |
string | a valid Redis Publish/Subscribe event. Supported events include: message |
handler |
function | function to call when the event arrives. Function will receive the channel name and the message object as parameters |
- Source:
publish(channel, message)
Publish a message to a channel. Any event handler registered for the 'message' event will be notified.
Parameters:
Name | Type | Description |
---|---|---|
channel |
string | the channel that the message will be published to |
message |
string | the message to publish to the channel |
- Source:
subscribe(channel)
subscribe to be notified of messages published to the specified channel. You must be registered and listening
for 'message' events to be notified of any published events to this channel.
Parameters:
Name | Type | Description |
---|---|---|
channel |
string | channel to listen on |
- Source: