Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 854c0a9658 | |||
| d753d09372 | |||
| febde17f0e | |||
| c52271c308 | |||
| 8460dd9f03 | |||
| 66fc108591 | |||
| 58491dea2b | |||
| cd220deb74 |
@@ -1,3 +1,7 @@
|
||||
### 0.10.0 / 2015-07-08
|
||||
|
||||
* Add the standard `code` and `reason` parameters to the `close` method
|
||||
|
||||
### 0.9.4 / 2015-03-08
|
||||
|
||||
* Don't send input to the driver before `start()` is called
|
||||
|
||||
@@ -77,8 +77,9 @@ If you need to detect when the WebSocket handshake is complete, you can use the
|
||||
If the connection's protocol version supports it, you can call `ws.ping()` to
|
||||
send a ping message and wait for the client's response. This method takes a
|
||||
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`.
|
||||
|
||||
```js
|
||||
ws.ping('Mic check, one, two', function() {
|
||||
@@ -221,7 +222,7 @@ Both server- and client-side `WebSocket` objects support the following API.
|
||||
that closed the connection.
|
||||
* <b>`send(message)`</b> accepts either a `String` or a `Buffer` and sends a
|
||||
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.
|
||||
* <b>`close(code, reason)`</b> closes the connection, sending the given status
|
||||
code and reason text, both of which are optional.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var WebSocket = require('../lib/faye/websocket'),
|
||||
var WebSocket = require('..').Client,
|
||||
deflate = require('permessage-deflate'),
|
||||
pace = require('pace');
|
||||
|
||||
@@ -7,7 +7,7 @@ var host = 'ws://localhost:9001',
|
||||
cases = 0,
|
||||
options = {extensions: [deflate]};
|
||||
|
||||
var socket = new WebSocket.Client(host + '/getCaseCount'),
|
||||
var socket = new WebSocket(host + '/getCaseCount'),
|
||||
url, progress;
|
||||
|
||||
socket.onmessage = function(event) {
|
||||
@@ -19,13 +19,13 @@ socket.onmessage = function(event) {
|
||||
var runCase = function(n) {
|
||||
if (n > cases) {
|
||||
url = host + '/updateReports?agent=' + agent;
|
||||
socket = new WebSocket.Client(url);
|
||||
socket = new WebSocket(url);
|
||||
socket.onclose = process.exit;
|
||||
return;
|
||||
}
|
||||
|
||||
url = host + '/runCase?case=' + n + '&agent=' + agent;
|
||||
socket = new WebSocket.Client(url, [], options);
|
||||
socket = new WebSocket(url, [], options);
|
||||
socket.pipe(socket);
|
||||
|
||||
socket.on('close', function() {
|
||||
|
||||
+14
-7
@@ -1,11 +1,18 @@
|
||||
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() {
|
||||
console.log('[open]', ws.headers);
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
var WebSocket = require('../lib/faye/websocket'),
|
||||
var WebSocket = require('..'),
|
||||
deflate = require('permessage-deflate'),
|
||||
fs = require('fs'),
|
||||
http = require('http'),
|
||||
|
||||
@@ -92,9 +92,17 @@ var instance = {
|
||||
return this._driver.ping(message, callback);
|
||||
},
|
||||
|
||||
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);
|
||||
},
|
||||
|
||||
_configureStream: function() {
|
||||
@@ -145,12 +153,12 @@ var instance = {
|
||||
_beginClose: function(reason, code) {
|
||||
if (this.readyState === API.CLOSED) return;
|
||||
this.readyState = API.CLOSING;
|
||||
this._closeParams = [reason, code];
|
||||
|
||||
if (this._stream) {
|
||||
this._stream.end();
|
||||
if (!this._stream.readable) this._finalizeClose();
|
||||
}
|
||||
this._closeParams = [reason, code];
|
||||
},
|
||||
|
||||
_finalizeClose: function() {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
var util = require('util'),
|
||||
net = require('net'),
|
||||
tls = require('tls'),
|
||||
crypto = require('crypto'),
|
||||
url = require('url'),
|
||||
driver = require('websocket-driver'),
|
||||
API = require('./api'),
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
, "keywords" : ["websocket", "eventsource"]
|
||||
, "license" : "MIT"
|
||||
|
||||
, "version" : "0.9.4"
|
||||
, "version" : "0.10.0"
|
||||
, "engines" : {"node": ">=0.4.0"}
|
||||
, "main" : "./lib/faye/websocket"
|
||||
, "dependencies" : {"websocket-driver": ">=0.5.1"}
|
||||
|
||||
+11
-12
@@ -1,14 +1,13 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICIzCCAYwCCQDZaunNGmqaHjANBgkqhkiG9w0BAQUFADBWMQsw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KoZIhvcNAQEBBQADgY0AMIGJAoGBAM8rbhbRDJlVsXdJ
|
||||
zP4QmQFTXZASd9P/rkxLM1J20N64YSNvaKsX4T/lq/detzMxfP82SKoHN3ItTIyI
|
||||
/DiSRWRQVfQ0f9m3xEPpbyvyHViyzRayy+xPGoqC27yTd+03KtMi8w/BrKUqDwFO
|
||||
xwmFPLxsOsBvcUztzKt/4GPao3htAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAALfl
|
||||
U2nO8N8KTziEsJkLc6JV5jGCoUQnhttsq6l07fZpTpX9nuF8tKhZ2jSNL5DntAqm
|
||||
M48g9rKd4wKp6IsPa66bkp/6u9k6hL2EhSWQTI7ii5Ap6u649XMB/lTEY4ZK/OGn
|
||||
dnWXbPWznhgi30ROUzxUCev+yRVdlgLBJFerXzk=
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
+13
-13
@@ -1,15 +1,15 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXQIBAAKBgQDXOuP0udRdjlcNSBmapePN0rFH+0Irh8hwmMXhwfAnkyl8mh+Y
|
||||
dyE5pqo80+TFoE2Ll39/V0X9laonC1qrNMSAHESgRNVaLizNLGzczL9cjRu4ptGz
|
||||
MsFzZTpTplIbY2GbxMeSNdFIia1cSKRJzYgrmXYArgfeOJf5UK53ZGqlrQIDAQAB
|
||||
AoGBAK8U+NrbUCXK5IWpYSqsR+PmwNANVIaUrjjqDg7X9MQ8skLqHUmpnx2GtnVE
|
||||
6ZTaEjq7wruUAxuF5CRe2CLtieouaLvF/gcAsff2Q4kL8taDrM54ECC69JFfijE4
|
||||
jJfEkoJRi1B0nq2QxJke3Sm3vrW2zLDqAZ4EUIh3uxXIYgcBAkEA+imv190S+bCM
|
||||
3H/3L5LHeTRwL58HWcYYjx+/K85yaCqf4wrwyYQ1jRho76uqkjq1mvL65nOniIxd
|
||||
NRnLTiQ+jwJBANxAiY4ww16fUkBGBh2np0FfDUhWgk5G5aZWHsK+5SJZXvlV0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Xf0AqDfqqwCX0cQgfTOPHE4iiol9aE+K5Di
|
||||
9wxhWKmmBAqb3iIyT8kCQQCtZiSOAu75DZdufUDUoAXCXPOwxga3Km+FoloRkp5e
|
||||
O2fJKycb9tnoeMvXqLHBV7FjKH+9fPfOnKpPSETWho+8
|
||||
-----END RSA PRIVATE KEY-----
|
||||
|
||||
Reference in New Issue
Block a user