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

websocket-stream

Package Overview
Dependencies
Maintainers
1
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 0.3.2 to 0.3.3

10

index.js

@@ -78,5 +78,9 @@ var stream = require('stream')

WebsocketStream.prototype._write = function(data) {
typeof WebSocket != 'undefined' && this.ws instanceof WebSocket
? this.ws.send(data)
: this.ws.send(data, { binary : isBuffer(data) })
if (this.ws.readyState == 1)
// we are connected
typeof WebSocket != 'undefined' && this.ws instanceof WebSocket
? this.ws.send(data)
: this.ws.send(data, { binary : isBuffer(data) })
else
this.emit('error', 'Not connected')
}

@@ -83,0 +87,0 @@

{
"name": "websocket-stream",
"version": "0.3.2",
"version": "0.3.3",
"description": "websockets with the node stream api. works in browser and node",

@@ -5,0 +5,0 @@ "scripts": {

@@ -24,1 +24,23 @@ var test = require('tape')

});
test('emitting not connected errors', function(t) {
echo.start(function() {
var client = websocket(echo.url, echo.options)
client.on('error', function() {
echo.stop(function() {
t.true(true, 'should emit error')
t.end()
})
})
client.once('data', function(data) {
client.end()
client.write('abcde')
})
client.write('hello world')
});
});
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