pub-sub-handler
Advanced tools
Comparing version
@@ -14,2 +14,3 @@ /* | ||
if( !options.port ) options.port = 6379; | ||
if( !callback ) callback = function(){}; | ||
@@ -16,0 +17,0 @@ subscribeClient = redis.createClient(options.port, options.host); |
{ | ||
"name": "pub-sub-handler", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Redis Pub/Sub with an object & key on message.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,3 +6,3 @@ ## Pub Sub Handler | ||
Setup: | ||
### Setup: | ||
@@ -15,3 +15,3 @@ ``` | ||
Subscribing: | ||
### Subscribing: | ||
@@ -24,3 +24,3 @@ ``` | ||
Publishing: | ||
### Publishing: | ||
@@ -31,3 +31,3 @@ ``` | ||
Unsubscribing: | ||
### Unsubscribing: | ||
@@ -38,4 +38,11 @@ ``` | ||
### End: | ||
(kill the Redis connections) | ||
``` | ||
psh.end(); | ||
``` | ||
## Common Use | ||
A typical use would be the key is a user id and the object is a socket. User connects to a web socket, you subscribe to a specified channel with the user id as a key and pass in the socket as the object. Then in your handler, when a message is published to the channel you have the socket to write the message to. |
6683
1.8%152
0.66%44
18.92%