File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 11
2+ 3.0.0 / 2017-05-13
3+ ==================
4+
5+ * [ feat] Make ` of ` return a new Emitter instance (#56 )
6+ * [ feat] Make the module compatible with socket.io-redis 5.x (#55 )
7+
282.0.0 / 2017-01-12
39==================
410
Original file line number Diff line number Diff line change @@ -43,6 +43,31 @@ var io = require('socket.io-emitter')(Cluster);
4343
4444```
4545
46+ ## Examples
47+
48+ ``` js
49+ var io = require (' socket.io-emitter' )({ host: ' 127.0.0.1' , port: 6379 });
50+
51+ // sending to all clients
52+ io .emit (' broadcast' , /* ... */ );
53+
54+ // sending to all clients in 'game' room
55+ io .to (' game' ).emit (' new-game' , /* ... */ );
56+
57+ // sending to individual socketid (private message)
58+ io .to (< socketid> ).emit (' private' , /* ... */ );
59+
60+ var nsp = io .of (' /admin' );
61+
62+ // sending to all clients in 'admin' namespace
63+ nsp .emit (' namespace' , /* ... */ );
64+
65+ // sending to all clients in 'admin' namespace and in 'notifications' room
66+ nsp .to (' notifications' ).emit (' namespace' , /* ... */ );
67+ ```
68+
69+ ** Note:** acknowledgements are not supported
70+
4671## Error handling
4772
4873Access the ` redis ` to subscribe to its ` error ` event:
Original file line number Diff line number Diff line change 11{
22 "name" : " socket.io-emitter" ,
3- "version" : " 2 .0.0" ,
3+ "version" : " 3 .0.0" ,
44 "description" : " " ,
55 "license" : " MIT" ,
66 "repository" : {
You can’t perform that action at this time.
0 commit comments