Socket
Socket
Sign inDemoInstall

faye-websocket

Package Overview
Dependencies
4
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.11.3 to 0.11.4

5

CHANGELOG.md

@@ -0,1 +1,5 @@

### 0.11.4 / 2021-05-24
- Prevent the client hanging if `close()` is called when already closing
### 0.11.3 / 2019-06-10

@@ -5,2 +9,3 @@

when the WebSocket is closed
- Change license from MIT to Apache 2.0

@@ -7,0 +12,0 @@ ### 0.11.2 / 2019-06-10

2

lib/faye/websocket.js

@@ -17,3 +17,3 @@ // API references:

this._stream = socket;
this._driver = driver.http(request, {maxLength: options.maxLength, protocols: protocols});
this._driver = driver.http(request, { maxLength: options.maxLength, protocols: protocols });

@@ -20,0 +20,0 @@ var self = this;

@@ -108,9 +108,11 @@ 'use strict';

if (this.readyState < API.CLOSING) {
var self = this;
this._closeTimer = setTimeout(function() {
self._beginClose('', 1006);
}, API.CLOSE_TIMEOUT);
}
if (this.readyState !== API.CLOSED) this.readyState = API.CLOSING;
var self = this;
this._closeTimer = setTimeout(function() {
self._beginClose('', 1006);
}, API.CLOSE_TIMEOUT);
this._driver.close(reason, code);

@@ -151,3 +153,3 @@ },

var event = new Event('message', {data: data});
var event = new Event('message', { data: data });
event.initEvent('message', false, false);

@@ -160,3 +162,3 @@ this.dispatchEvent(event);

var event = new Event('error', {message: message});
var event = new Event('error', { message: message });
event.initEvent('error', false, false);

@@ -191,3 +193,3 @@ this.dispatchEvent(event);

var event = new Event('close', {code: code, reason: reason});
var event = new Event('close', { code: code, reason: reason });
event.initEvent('close', false, false);

@@ -194,0 +196,0 @@ this.dispatchEvent(event);

@@ -11,3 +11,3 @@ 'use strict';

var DEFAULT_PORTS = {'http:': 80, 'https:': 443, 'ws:':80, 'wss:': 443},
var DEFAULT_PORTS = { 'http:': 80, 'https:': 443, 'ws:':80, 'wss:': 443 },
SECURE_PROTOCOLS = ['https:', 'wss:'];

@@ -19,3 +19,3 @@

this.url = _url;
this._driver = driver.client(this.url, {maxLength: options.maxLength, protocols: protocols});
this._driver = driver.client(this.url, { maxLength: options.maxLength, protocols: protocols });

@@ -72,3 +72,3 @@ ['open', 'error'].forEach(function(event) {

this._proxy.pipe(this._stream, {end: false});
this._proxy.pipe(this._stream, { end: false });
this._stream.pipe(this._proxy);

@@ -78,3 +78,3 @@

if (secure) {
var options = {socket: self._stream, servername: uri.hostname};
var options = { socket: self._stream, servername: uri.hostname };
for (name in originTLS) options[name] = originTLS[name];

@@ -81,0 +81,0 @@ self._stream = tls.connect(options);

@@ -1,2 +0,2 @@

Copyright 2010-2019 James Coglan
Copyright 2010-2021 James Coglan

@@ -3,0 +3,0 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use

@@ -11,3 +11,3 @@ {

"license": "Apache-2.0",
"version": "0.11.3",
"version": "0.11.4",
"engines": {

@@ -14,0 +14,0 @@ "node": ">=0.8.0"

@@ -1,2 +0,2 @@

# faye-websocket [![Build status](https://secure.travis-ci.org/faye/faye-websocket-node.svg)](http://travis-ci.org/faye/faye-websocket-node)
# faye-websocket

@@ -41,7 +41,7 @@ This is a general-purpose WebSocket implementation extracted from the

var ws = new WebSocket(request, socket, body);
ws.on('message', function(event) {
ws.send(event.data);
});
ws.on('close', function(event) {

@@ -124,4 +124,4 @@ console.log('close', event.code, event.reason);

origin: 'http://username:password@proxy.example.com',
headers: {'User-Agent': 'node'},
tls: {cert: fs.readFileSync('client.crt')}
headers: { 'User-Agent': 'node' },
tls: { cert: fs.readFileSync('client.crt') }
}

@@ -169,3 +169,3 @@ });

var ws = new WebSocket(request, socket, body, [], {extensions: [deflate]});
var ws = new WebSocket(request, socket, body, [], { extensions: [deflate] });
```

@@ -206,3 +206,3 @@

[`tls.connect()`](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback)
- `ca` - (legacy) a shorthand for passing `{tls: {ca: value}}`
- `ca` - (legacy) a shorthand for passing `{ tls: { ca: value } }`

@@ -256,6 +256,6 @@

console.log('open', es.url, es.lastEventId);
// Periodically send messages
var loop = setInterval(function() { es.send('Hello') }, 1000);
es.on('close', function() {

@@ -265,6 +265,6 @@ clearInterval(loop);

});
} else {
// Normal HTTP request
response.writeHead(200, {'Content-Type': 'text/plain'});
response.writeHead(200, { 'Content-Type': 'text/plain' });
response.end('Hello');

@@ -282,3 +282,3 @@ }

```js
es.send('Breaking News!', {event: 'notification', id: '99'});
es.send('Breaking News!', { event: 'notification', id: '99' });
```

@@ -310,3 +310,3 @@

var es = new EventSource(request, response, {
headers: {'Access-Control-Allow-Origin': '*'},
headers: { 'Access-Control-Allow-Origin': '*' },
ping: 15,

@@ -313,0 +313,0 @@ retry: 10

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc