Comparing version 0.0.7 to 0.0.8
@@ -7,3 +7,3 @@ module.exports = { | ||
"request" : require('./WebSocketRequest'), | ||
"version" : "0.0.7" | ||
"version" : "0.0.8" | ||
}; |
@@ -52,2 +52,10 @@ var extend = require('./utils').extend; | ||
assembleFragments: true, | ||
// The Nagle Algorithm makes more efficient use of network resources | ||
// by introducing a small delay before sending small packets so that | ||
// multiple messages can be batched together before going onto the | ||
// wire. This however comes at the cost of latency, so the default | ||
// is to disable it. If you don't need low latency and are streaming | ||
// lots of small messages, you can change this to 'false' | ||
disableNagleAlgorithm: true, | ||
@@ -124,2 +132,8 @@ // The number of milliseconds to wait after sending a close frame | ||
var hostHeaderValue = this.url.hostname; | ||
if ((this.url.protocol === 'ws:' && this.url.port !== '80') || | ||
(this.url.protocol === 'wss:' && this.url.port !== '443')) { | ||
hostHeaderValue += (":" + this.url.port) | ||
} | ||
// FIXME: Using old http.createClient interface since Node's new | ||
@@ -133,3 +147,3 @@ // Agent-based API is buggy. | ||
'Sec-WebSocket-Key': this.base64nonce, | ||
'Host': this.url.hostname | ||
'Host': hostHeaderValue | ||
}; | ||
@@ -136,0 +150,0 @@ if (this.protocols.length > 0) { |
@@ -57,2 +57,5 @@ var crypto = require('crypto'); | ||
// Disable nagle algorithm? | ||
this.socket.setNoDelay(this.config.disableNagleAlgorithm); | ||
this.outgoingFrameQueue = []; | ||
@@ -59,0 +62,0 @@ this.outputPaused = false; |
@@ -69,3 +69,4 @@ var crypto = require('crypto'); | ||
WebSocketRequest.prototype.readHandshake = function(request) { | ||
if (!request.headers['host']) { | ||
this.host = request.headers['host']; | ||
if (!this.host) { | ||
throw new Error("Client must provide a Host header."); | ||
@@ -72,0 +73,0 @@ } |
@@ -65,2 +65,10 @@ var extend = require('./utils').extend; | ||
// The Nagle Algorithm makes more efficient use of network resources | ||
// by introducing a small delay before sending small packets so that | ||
// multiple messages can be batched together before going onto the | ||
// wire. This however comes at the cost of latency, so the default | ||
// is to disable it. If you don't need low latency and are streaming | ||
// lots of small messages, you can change this to 'false' | ||
disableNagleAlgorithm: true, | ||
// The number of milliseconds to wait after sending a close frame | ||
@@ -67,0 +75,0 @@ // for an acknowledgement to come back before giving up and just |
@@ -6,3 +6,3 @@ { | ||
"author": "Brian McKelvey <brian@worlize.com>", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"repository": { | ||
@@ -9,0 +9,0 @@ "type": "git", |
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
262376
6903