socket.io-emitter
Advanced tools
Comparing version 0.1.0 to 0.2.0
0.2.0 / 2014-06-07 | ||
================== | ||
* package: bump dependencies | ||
* added possibility to connect with unix domain socket | ||
* added support for emitting to namespace. [Rase-] | ||
0.1.0 / 2014-03-12 | ||
@@ -3,0 +10,0 @@ ================== |
27
index.js
@@ -52,5 +52,7 @@ | ||
if (!redis) { | ||
if (!opts.host) throw new Error('Missing redis `host`'); | ||
if (!opts.port) throw new Error('Missing redis `port`'); | ||
redis = client(opts.port, opts.host); | ||
if (!opts.socket && !opts.host) throw new Error('Missing redis `host`'); | ||
if (!opts.socket && !opts.port) throw new Error('Missing redis `port`'); | ||
redis = opts.socket | ||
? client(opts.socket) | ||
: client(opts.port, opts.host); | ||
} | ||
@@ -93,2 +95,14 @@ | ||
/** | ||
* Limit emission to certain `namespace`. | ||
* | ||
* @param {String} namespace | ||
*/ | ||
Emitter.prototype.of = function(nsp) { | ||
debug('nsp set to %s', nsp); | ||
this._flags.nsp = nsp; | ||
return this; | ||
}; | ||
/** | ||
* Send the packet. | ||
@@ -105,2 +119,9 @@ * | ||
packet.data = args; | ||
// set namespace to packet | ||
if (this._flags.nsp) { | ||
packet.nsp = this._flags.nsp; | ||
delete this._flags.nsp; | ||
} else { | ||
packet.nsp = '/'; | ||
} | ||
@@ -107,0 +128,0 @@ // publish |
{ | ||
"name": "socket.io-emitter", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "", | ||
@@ -9,5 +9,13 @@ "dependencies": { | ||
"msgpack-js": "0.3.0", | ||
"has-binary-data": "0.1.0", | ||
"socket.io-parser": "2.1.1" | ||
"has-binary-data": "0.1.1", | ||
"socket.io-parser": "2.2.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "1.18.1", | ||
"expect.js": "0.3.1", | ||
"socket.io": "1.0.4", | ||
"socket.io-client": "1.0.4", | ||
"socket.io-redis": "0.1.3", | ||
"redis": "0.10.1" | ||
} | ||
} |
@@ -29,2 +29,3 @@ | ||
- `port`: port to connect to redis on (`6379`) | ||
- `socket`: unix domain socket to connect to redis on (`"/tmp/redis.sock"`) | ||
@@ -47,4 +48,9 @@ ### Emitter(clientUri[, opts] | ||
### Emitter#of(namespace:String):Emitter | ||
Specifies a specific namespace that you want to emit to. | ||
## License | ||
MIT |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
7417
8
198
55
6
1
+ Addedhas-binary-data@0.1.1(transitive)
+ Addedsocket.io-parser@2.2.0(transitive)
- Removedhas-binary-data@0.1.0(transitive)
- Removedsocket.io-parser@2.1.1(transitive)
Updatedhas-binary-data@0.1.1
Updatedsocket.io-parser@2.2.0