faye-websocket
Advanced tools
Comparing version 0.9.4 to 0.10.0
@@ -0,1 +1,5 @@ | ||
### 0.10.0 / 2015-07-08 | ||
* Add the standard `code` and `reason` parameters to the `close` method | ||
### 0.9.4 / 2015-03-08 | ||
@@ -2,0 +6,0 @@ |
@@ -1,2 +0,2 @@ | ||
var WebSocket = require('../lib/faye/websocket'), | ||
var WebSocket = require('..').Client, | ||
deflate = require('permessage-deflate'), | ||
@@ -10,3 +10,3 @@ pace = require('pace'); | ||
var socket = new WebSocket.Client(host + '/getCaseCount'), | ||
var socket = new WebSocket(host + '/getCaseCount'), | ||
url, progress; | ||
@@ -23,3 +23,3 @@ | ||
url = host + '/updateReports?agent=' + agent; | ||
socket = new WebSocket.Client(url); | ||
socket = new WebSocket(url); | ||
socket.onclose = process.exit; | ||
@@ -30,3 +30,3 @@ return; | ||
url = host + '/runCase?case=' + n + '&agent=' + agent; | ||
socket = new WebSocket.Client(url, [], options); | ||
socket = new WebSocket(url, [], options); | ||
socket.pipe(socket); | ||
@@ -33,0 +33,0 @@ |
@@ -1,10 +0,17 @@ | ||
var WebSocket = require('../lib/faye/websocket'), | ||
fs = require('fs'); | ||
var WebSocket = require('..').Client, | ||
deflate = require('permessage-deflate'), | ||
fs = require('fs'); | ||
var url = process.argv[2], | ||
headers = {Origin: 'http://faye.jcoglan.com'}, | ||
ca = fs.readFileSync(__dirname + '/../spec/server.crt'), | ||
proxy = {origin: process.argv[3], headers: {'User-Agent': 'Echo'}, tls: {ca: ca}}, | ||
ws = new WebSocket.Client(url, [], {headers: headers, proxy: proxy, tls: {ca: ca}}); | ||
var url = process.argv[2], | ||
proxy = process.argv[3], | ||
ca = fs.readFileSync(__dirname + '/../spec/server.crt'), | ||
tls = {ca: ca}; | ||
var ws = new WebSocket(url, [], { | ||
proxy: {origin: proxy, headers: {'User-Agent': 'Echo'}, tls: tls}, | ||
tls: tls, | ||
headers: {Origin: 'http://faye.jcoglan.com'}, | ||
extensions: [deflate] | ||
}); | ||
ws.onopen = function() { | ||
@@ -11,0 +18,0 @@ console.log('[open]', ws.headers); |
@@ -1,2 +0,2 @@ | ||
var WebSocket = require('../lib/faye/websocket'), | ||
var WebSocket = require('..'), | ||
deflate = require('permessage-deflate'), | ||
@@ -3,0 +3,0 @@ fs = require('fs'), |
@@ -95,5 +95,13 @@ var Stream = require('stream').Stream, | ||
close: function() { | ||
close: function(code, reason) { | ||
if (code === undefined) code = 1000; | ||
if (reason === undefined) reason = ''; | ||
if (code !== 1000 && (code < 3000 || code > 4999)) | ||
throw new Error("Failed to execute 'close' on WebSocket: " + | ||
"The code must be either 1000, or between 3000 and 4999. " + | ||
code + " is neither."); | ||
if (this.readyState !== API.CLOSED) this.readyState = API.CLOSING; | ||
this._driver.close(); | ||
this._driver.close(reason, code); | ||
}, | ||
@@ -149,2 +157,3 @@ | ||
this.readyState = API.CLOSING; | ||
this._closeParams = [reason, code]; | ||
@@ -155,3 +164,2 @@ if (this._stream) { | ||
} | ||
this._closeParams = [reason, code]; | ||
}, | ||
@@ -158,0 +166,0 @@ |
var util = require('util'), | ||
net = require('net'), | ||
tls = require('tls'), | ||
crypto = require('crypto'), | ||
url = require('url'), | ||
@@ -6,0 +5,0 @@ driver = require('websocket-driver'), |
@@ -8,3 +8,3 @@ { "name" : "faye-websocket" | ||
, "version" : "0.9.4" | ||
, "version" : "0.10.0" | ||
, "engines" : {"node": ">=0.4.0"} | ||
@@ -11,0 +11,0 @@ , "main" : "./lib/faye/websocket" |
@@ -80,4 +80,5 @@ # faye-websocket | ||
message string, and an optional callback that fires when a matching pong message | ||
is received. It returns `true` iff a ping message was sent. If the client does | ||
not support ping/pong, this method sends no data and returns `false`. | ||
is received. It returns `true` if and only if a ping message was sent. If the | ||
client does not support ping/pong, this method sends no data and returns | ||
`false`. | ||
@@ -225,3 +226,3 @@ ```js | ||
text or binary message over the connection to the other peer. | ||
* <b>`ping(message = '', function() {})`</b> sends a ping frame with an optional | ||
* <b>`ping(message, function() {})`</b> sends a ping frame with an optional | ||
message and fires the callback when a matching pong is received. | ||
@@ -228,0 +229,0 @@ * <b>`close(code, reason)`</b> closes the connection, sending the given status |
36313
498
337