websocket-stream
Advanced tools
Comparing version 4.0.0 to 5.0.0
{ | ||
"name": "websocket-stream", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"license": "BSD-2-Clause", | ||
@@ -30,3 +30,3 @@ "description": "Use websockets with the node streams API. Works in browser and node", | ||
"safe-buffer": "^5.0.1", | ||
"ws": "^2.2.3", | ||
"ws": "^3.0.0", | ||
"xtend": "^4.0.0" | ||
@@ -33,0 +33,0 @@ }, |
@@ -23,3 +23,3 @@ # websocket-stream | ||
The available options differs depending on if you use this module in the browser or with node.js. Options can be passed in as the third or second argument - `WebSocket(address, [protocols], [options])` | ||
The available options differs depending on if you use this module in the browser or with node.js. Options can be passed in as the third or second argument - `WebSocket(address, [protocols], [options])`. | ||
@@ -58,3 +58,3 @@ ##### `options.browserBufferSize` | ||
Default: `true` | ||
Default: `true` on the client, `false` on the server. | ||
@@ -70,2 +70,4 @@ Example: | ||
Beware that this option is ignored by browser clients. To make sure that permessage-deflate is never used, disable it on the server. | ||
##### Other options | ||
@@ -83,3 +85,4 @@ | ||
function handle(stream) { | ||
function handle(stream, request) { | ||
// `request` is the upgrade request sent by the client. | ||
fs.createReadStream('bigdata.json').pipe(stream) | ||
@@ -86,0 +89,0 @@ } |
@@ -14,4 +14,4 @@ 'use strict' | ||
proxied = true | ||
this.on('connection', function(conn) { | ||
this.emit('stream', stream(conn, opts)) | ||
this.on('connection', function(conn, req) { | ||
this.emit('stream', stream(conn, opts), req) | ||
}) | ||
@@ -18,0 +18,0 @@ } |
11
test.js
@@ -196,6 +196,6 @@ var test = require('tape') | ||
t.plan(1) | ||
var server = http.createServer() | ||
websocket.createServer({ server: server }, handle) | ||
function handle (stream) { | ||
@@ -214,3 +214,3 @@ stream.pipe(concat(function (body) { | ||
test('stream handlers should fire once per connection', function(t) { | ||
t.plan(1) | ||
t.plan(2) | ||
@@ -225,3 +225,6 @@ var server = http.createServer() | ||
var m = 0 | ||
wss.on('stream', function() { m++ }) | ||
wss.on('stream', function(stream, request) { | ||
t.ok(request instanceof http.IncomingMessage) | ||
m++ | ||
}) | ||
server.listen(0, function() { | ||
@@ -228,0 +231,0 @@ var w = websocket('ws://localhost:' + server.address().port) |
Sorry, the diff of this file is not supported yet
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
22127
562
121
+ Addedasync-limiter@1.0.1(transitive)
+ Addedws@3.3.3(transitive)
- Removedsafe-buffer@5.0.1(transitive)
- Removedws@2.3.1(transitive)
Updatedws@^3.0.0