Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

websocket-stream

Package Overview
Dependencies
Maintainers
5
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

websocket-stream - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0

4

collaborators.md

@@ -5,3 +5,5 @@ ## Collaborators

<table><tbody><tr><th align="left">maxogden</th><td><a href="https://github.com/maxogden">GitHub/maxogden</a></td></tr>
<table><tbody><tr><th align="left">gst</th><td><a href="https://github.com/gst">GitHub/gst</a></td></tr>
<tr><th align="left">maxogden</th><td><a href="https://github.com/maxogden">GitHub/maxogden</a></td></tr>
<tr><th align="left">deanlandolt</th><td><a href="https://github.com/deanlandolt">GitHub/deanlandolt</a></td></tr>
<tr><th align="left">mcollina</th><td><a href="https://github.com/mcollina">GitHub/mcollina</a></td></tr>

@@ -8,0 +10,0 @@ <tr><th align="left">jnordberg</th><td><a href="https://github.com/jnordberg">GitHub/jnordberg</a></td></tr>

{
"name": "websocket-stream",
"version": "3.0.1",
"version": "3.1.0",
"license": "BSD-2-Clause",

@@ -5,0 +5,0 @@ "description": "Use websockets with the node streams API. Works in browser and node",

@@ -9,3 +9,6 @@ var through = require('through2')

var stream, socket
var socketWrite = process.title === 'browser' ? socketWriteBrowser : socketWriteNode
var isBrowser = process.title === 'browser'
var isNative = !!global.WebSocket
var socketWrite = isBrowser ? socketWriteBrowser : socketWriteNode
var proxy = through.obj(socketWrite, socketEnd)

@@ -23,2 +26,3 @@

var bufferSize = options.browserBufferSize || 1024 * 512
// browser only: how long to wait when throttling

@@ -32,3 +36,10 @@ var bufferTimeout = options.browserBufferTimeout || 1000

} else {
socket = new WS(target, protocols, options)
// special constructor treatment for native websockets in browsers, see
// https://github.com/maxogden/websocket-stream/issues/82
if (isNative && isBrowser) {
socket = new WS(target, protocols)
} else {
socket = new WS(target, protocols, options)
}
socket.binaryType = 'arraybuffer'

@@ -35,0 +46,0 @@ }

@@ -98,2 +98,21 @@ var test = require('tape')

test('drain', function(t) {
t.plan(1)
echo.start(function() {
var client = websocket(echo.url, echo.options)
client.on('drain', function() {
client.destroy()
echo.stop(function() {
t.pass('drained')
})
})
// write until buffer is full
while (client.write('foobar')) {}
})
})
test('emit sending errors if the socket is closed by the other party', function(t) {

@@ -100,0 +119,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc