Skip to content

Commit 2adcdb2

Browse files
[chore] Release 3.0.0
1 parent a3cbc84 commit 2adcdb2

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

History.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
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+
28
2.0.0 / 2017-01-12
39
==================
410

Readme.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff 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

4873
Access the `redis` to subscribe to its `error` event:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "socket.io-emitter",
3-
"version": "2.0.0",
3+
"version": "3.0.0",
44
"description": "",
55
"license": "MIT",
66
"repository": {

0 commit comments

Comments
 (0)