new PubSubClient()
Constructor
Properties:
Name | Type | Description |
---|---|---|
pubConnector |
object | PUB client connector (RedisClient) |
subClient |
object | SUB client (RedisClient) |
channels |
Map | Registered channels (name → Set of handlers) |
Methods
-
done()
-
Client termination
-
<async> subscribe(channel, handler)
-
Subscribe to a channel
Parameters:
Name Type Description channel
string Channel name handler
Subscriber Handler function Returns:
Resolves on success- Type
- Promise
-
<async> unsubscribe(channel, handler)
-
Unsubscribe from a channel
Parameters:
Name Type Description channel
string Channel name handler
Subscriber Handler function Returns:
Resolves on success- Type
- Promise
-
<async> publish(channel, message)
-
Publish a message after passing it through JSON.stringify()
Parameters:
Name Type Description channel
string Channel name message
* Message Returns:
Resolves on success- Type
- Promise