websocket-stream
Advanced tools
Comparing version 2.1.0 to 2.2.0
{ | ||
"name": "websocket-stream", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"license": "BSD-2-Clause", | ||
@@ -5,0 +5,0 @@ "description": "Use websockets with the node streams API. Works in browser and node", |
@@ -31,3 +31,3 @@ # websocket-stream | ||
fs.createReadStream('bigdata.json').pipe(stream) | ||
}) | ||
} | ||
``` | ||
@@ -34,0 +34,0 @@ |
@@ -15,4 +15,6 @@ | ||
var proxied = false | ||
this.on('newListener', function(event) { | ||
if (event === 'stream') { | ||
if (!proxied && event === 'stream') { | ||
proxied = true | ||
this.on('connection', function(conn) { | ||
@@ -19,0 +21,0 @@ this.emit('stream', stream(conn)) |
18
test.js
@@ -191,1 +191,19 @@ var test = require('tape') | ||
}) | ||
test('stream handlers should fire once per connection', function(t) { | ||
t.plan(1) | ||
var server = http.createServer() | ||
var wss = websocket.createServer({ server: server }, function() { | ||
server.close(function() { | ||
t.equal(m, 1) | ||
}) | ||
}) | ||
var m = 0 | ||
wss.on('stream', function() { m++ }) | ||
server.listen(0, function() { | ||
var w = websocket('ws://localhost:' + server.address().port) | ||
w.end('pizza cats\n') | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13145
325