From 2adcdb2eb6d8b2cd886d1d7b90ff1ec1b5352f41 Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Sat, 13 May 2017 08:30:12 +0200 Subject: [PATCH] [chore] Release 3.0.0 --- History.md | 6 ++++++ Readme.md | 25 +++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/History.md b/History.md index 2949b8e..6c39289 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,10 @@ +3.0.0 / 2017-05-13 +================== + + * [feat] Make `of` return a new Emitter instance (#56) + * [feat] Make the module compatible with socket.io-redis 5.x (#55) + 2.0.0 / 2017-01-12 ================== diff --git a/Readme.md b/Readme.md index e73ed54..e851d1e 100644 --- a/Readme.md +++ b/Readme.md @@ -43,6 +43,31 @@ var io = require('socket.io-emitter')(Cluster); ``` +## Examples + +```js + var io = require('socket.io-emitter')({ host: '127.0.0.1', port: 6379 }); + + // sending to all clients + io.emit('broadcast', /* ... */); + + // sending to all clients in 'game' room + io.to('game').emit('new-game', /* ... */); + + // sending to individual socketid (private message) + io.to().emit('private', /* ... */); + + var nsp = io.of('/admin'); + + // sending to all clients in 'admin' namespace + nsp.emit('namespace', /* ... */); + + // sending to all clients in 'admin' namespace and in 'notifications' room + nsp.to('notifications').emit('namespace', /* ... */); +``` + +**Note:** acknowledgements are not supported + ## Error handling Access the `redis` to subscribe to its `error` event: diff --git a/package.json b/package.json index 91440b4..9a17b79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "socket.io-emitter", - "version": "2.0.0", + "version": "3.0.0", "description": "", "license": "MIT", "repository": {