socket.io-emitter
Advanced tools
Comparing version 1.0.0 to 1.1.0
1.1.0 / 2017-01-12 | ||
================== | ||
* [docs] Updated README with more usage examples. (#33) | ||
* [feature] Removed clientUri() (#41) | ||
1.0.0 / 2015-12-10 | ||
@@ -3,0 +9,0 @@ ================== |
16
index.js
@@ -51,3 +51,3 @@ | ||
if ('string' == typeof redis) { | ||
redis = clientUri(redis); | ||
redis = client(redis); | ||
} | ||
@@ -159,15 +159,1 @@ | ||
}; | ||
/** | ||
* Create a redis client from a | ||
* `host:port` uri string. | ||
* | ||
* @param {String} uri | ||
* @return {Client} node client | ||
* @api private | ||
*/ | ||
function clientUri(uri){ | ||
uri = uri.split(':'); | ||
return client(uri[1], uri[0]); | ||
} |
{ | ||
"name": "socket.io-emitter", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -18,3 +18,30 @@ | ||
``` | ||
```js | ||
// Different constructor options. | ||
//1. Initialize with host:port string | ||
var io = require('socket.io-emitter')("loaclhost:6379") | ||
// 2. Initlize with host, port object. | ||
var io = require('socket.io-emitter')({ host: '127.0.0.1', port: 6379 }); | ||
// 3. Can use other node_redis compatible client eg; ioredis. | ||
var Redis = require("ioredis"); | ||
var redis = new Redis(); | ||
var io = require('socket.io-emitter')(redis); | ||
// Make the emitter works with redis clustered environment. | ||
var Cluster = new Redis.Cluster([ | ||
{ | ||
host: "localhost", | ||
port: 6379 | ||
}, | ||
{ | ||
host: "localhost", | ||
port: 6378 | ||
}, | ||
]); | ||
var io = require('socket.io-emitter')(Cluster); | ||
``` | ||
## API | ||
@@ -21,0 +48,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
11659
85
278
2