File tree Expand file tree Collapse file tree 3 files changed +7
-1
lines changed
Expand file tree Collapse file tree 3 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -13,3 +13,4 @@ results
1313
1414npm-debug.log
1515node_modules
16+ .idea
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ The following options are allowed:
3232- ` key ` : the name of the key to pub/sub events on as prefix (` socket.io ` )
3333- ` host ` : host to connect to redis on (` localhost ` )
3434- ` port ` : port to connect to redis on (` 6379 ` )
35+ - ` subEvent ` : optional, the redis client event name to subscribe to (` message ` )
3536- ` pubClient ` : optional, the redis client to publish events on
3637- ` subClient ` : optional, the redis client to subscribe to events on
3738
@@ -42,6 +43,9 @@ with an equivalent API.
4243If you supply clients, make sure you initialized them with
4344the ` return_buffers ` option set to ` true ` .
4445
46+ You can supply [ ioredis] ( https://github.com/luin/ioredis ) as a client
47+ by providing ` messageBuffer ` as the subEvent option.
48+
4549### RedisAdapter
4650
4751The redis adapter instances expose the following properties
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ function adapter(uri, opts){
4747 var pub = opts . pubClient ;
4848 var sub = opts . subClient ;
4949 var prefix = opts . key || 'socket.io' ;
50+ var subEvent = opts . subEvent || 'message' ;
5051
5152 // init clients if needed
5253 if ( ! pub ) pub = redis ( port , host ) ;
@@ -74,7 +75,7 @@ function adapter(uri, opts){
7475 sub . subscribe ( prefix + '#' + nsp . name + '#' , function ( err ) {
7576 if ( err ) self . emit ( 'error' , err ) ;
7677 } ) ;
77- sub . on ( 'message' , this . onmessage . bind ( this ) ) ;
78+ sub . on ( subEvent , this . onmessage . bind ( this ) ) ;
7879 }
7980
8081 /**
You can’t perform that action at this time.
0 commit comments