faye-websocket
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -0,1 +1,7 @@ | ||
### 0.7.1 / 2013-12-03 | ||
* Support the `maxLength` websocket-driver option | ||
* Make the client emit `error` events on network errors | ||
### 0.7.0 / 2013-09-09 | ||
@@ -2,0 +8,0 @@ |
@@ -12,5 +12,7 @@ // API references: | ||
var WebSocket = function(request, socket, body, protocols, options) { | ||
this._stream = socket; | ||
this._driver = driver.http(request, {protocols: protocols}); | ||
options = options || {}; | ||
this._stream = socket; | ||
this._driver = driver.http(request, {maxLength: options.maxLength, protocols: protocols}); | ||
var self = this; | ||
@@ -17,0 +19,0 @@ if (!this._stream || !this._stream.writable) return; |
@@ -5,8 +5,11 @@ var util = require('util'), | ||
driver = require('websocket-driver'), | ||
API = require('./api'); | ||
API = require('./api'), | ||
Event = require('./api/event'); | ||
var Client = function(url, protocols, options) { | ||
options = options || {}; | ||
this.url = url; | ||
this._uri = require('url').parse(url); | ||
this._driver = driver.client(url, {protocols: protocols}); | ||
this._driver = driver.client(url, {maxLength: options.maxLength, protocols: protocols}); | ||
@@ -25,3 +28,3 @@ ['open', 'error'].forEach(function(event) { | ||
if (options && options.ca) tlsOptions.ca = options.ca; | ||
if (options.ca) tlsOptions.ca = options.ca; | ||
@@ -40,5 +43,10 @@ var connection = secure | ||
['error', 'end'].forEach(function(event) { | ||
this._stream.on(event, function() { self._finalize('', 1006) }); | ||
}, this); | ||
this._stream.on('end', function() { self._finalize('', 1006) }); | ||
this._stream.on('error', function(error) { | ||
var event = new Event('error', {message: 'Network error: ' + url + ': ' + error.message}); | ||
event.initEvent('error', false, false); | ||
self.dispatchEvent(event); | ||
self._finalize('', 1006); | ||
}); | ||
}; | ||
@@ -45,0 +53,0 @@ util.inherits(Client, API); |
@@ -8,6 +8,6 @@ { "name" : "faye-websocket" | ||
, "version" : "0.7.0" | ||
, "version" : "0.7.1" | ||
, "engines" : {"node": ">=0.4.0"} | ||
, "main" : "./lib/faye/websocket" | ||
, "dependencies" : {"websocket-driver": ">=0.3.0"} | ||
, "dependencies" : {"websocket-driver": ">=0.3.1"} | ||
, "devDependencies" : {"jstest": "", "pace": ""} | ||
@@ -14,0 +14,0 @@ |
@@ -158,2 +158,4 @@ # faye-websocket | ||
be sent during the handshake process | ||
* `maxLength` - the maximum allowed size of incoming message frames, in bytes. | ||
The default value is `2^30 - 1`, or 1 byte short of 1 GiB. | ||
* `ping` - an integer that sets how often the WebSocket should send ping | ||
@@ -160,0 +162,0 @@ frames, measured in seconds |
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
30714
414
296
Updatedwebsocket-driver@>=0.3.1