Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dc392490a8 | |||
| 0feee7974c | |||
| 91d8e1ad41 | |||
| c27fee0680 | |||
| 061494bc2c | |||
| 958d3a458f | |||
| 2d945cff5d | |||
| d3340cdd63 | |||
| 0d15d7a3ec | |||
| cdc7f0891b | |||
| f8c5b86e10 | |||
| 53db3d6c25 | |||
| dcb3375dda |
+6
-1
@@ -1,7 +1,12 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
||||
- "0.12"
|
||||
- "iojs"
|
||||
- "iojs-1"
|
||||
- "iojs-2"
|
||||
- "iojs-3"
|
||||
- "4"
|
||||
- "5"
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
### 0.11.0 / 2016-02-24
|
||||
|
||||
* Introduce a `net` option to the `Client` class for setting things like, say, `servername`
|
||||
|
||||
### 0.10.0 / 2015-07-08
|
||||
|
||||
* Add the standard `code` and `reason` parameters to the `close` method
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Code of Conduct
|
||||
|
||||
All projects under the [Faye](https://github.com/faye) umbrella are covered by
|
||||
the [Code of Conduct](https://github.com/faye/code-of-conduct).
|
||||
@@ -9,7 +9,7 @@ This is a general-purpose WebSocket implementation extracted from the
|
||||
[Faye](http://faye.jcoglan.com) project. It provides classes for easily building
|
||||
WebSocket servers and clients in Node. It does not provide a server itself, but
|
||||
rather makes it easy to handle WebSocket connections within an existing
|
||||
[Node](http://nodejs.org/) application. It does not provide any abstraction
|
||||
[Node](https://nodejs.org/) application. It does not provide any abstraction
|
||||
other than the standard [WebSocket API](http://dev.w3.org/html5/websockets/).
|
||||
|
||||
It also provides an abstraction for handling
|
||||
@@ -130,8 +130,8 @@ var ws = new WebSocket.Client('ws://www.example.com/', [], {
|
||||
});
|
||||
```
|
||||
|
||||
The `tls` value is a Node 'TLS options' object that will be passed to
|
||||
[`tls.connect()`](http://nodejs.org/api/tls.html#tls_tls_connect_options_callback).
|
||||
The `tls` value is an object that will be passed to
|
||||
[`tls.connect()`](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback).
|
||||
|
||||
|
||||
## Subprotocol negotiation
|
||||
@@ -198,9 +198,12 @@ var ws = new WebSocket.Client(url, protocols, options);
|
||||
The client accepts some additional options:
|
||||
|
||||
* `proxy` - settings for a proxy as described above
|
||||
* `tls` - a Node 'TLS options' object containing TLS settings for the origin
|
||||
server, this will be passed to
|
||||
[`tls.connect()`](http://nodejs.org/api/tls.html#tls_tls_connect_options_callback)
|
||||
* `net` - an object containing settings for the origin server that will be
|
||||
passed to
|
||||
[`net.connect()`](https://nodejs.org/api/net.html#net_socket_connect_options_connectlistener)
|
||||
* `tls` - an object containing TLS settings for the origin server, this will be
|
||||
passed to
|
||||
[`tls.connect()`](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback)
|
||||
* `ca` - (legacy) a shorthand for passing `{tls: {ca: value}}`
|
||||
|
||||
|
||||
@@ -316,7 +319,7 @@ some data over the wire to keep the connection alive.
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2010-2015 James Coglan
|
||||
Copyright (c) 2010-2016 James Coglan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the 'Software'), to deal in
|
||||
|
||||
@@ -22,20 +22,25 @@ var Client = function(_url, protocols, options) {
|
||||
});
|
||||
}, this);
|
||||
|
||||
var proxy = options.proxy || {},
|
||||
endpoint = url.parse(proxy.origin || this.url),
|
||||
port = endpoint.port || DEFAULT_PORTS[endpoint.protocol],
|
||||
secure = SECURE_PROTOCOLS.indexOf(endpoint.protocol) >= 0,
|
||||
onConnect = function() { self._onConnect() },
|
||||
originTLS = options.tls || {},
|
||||
socketTLS = proxy.origin ? (proxy.tls || {}) : originTLS,
|
||||
self = this;
|
||||
var proxy = options.proxy || {},
|
||||
endpoint = url.parse(proxy.origin || this.url),
|
||||
port = endpoint.port || DEFAULT_PORTS[endpoint.protocol],
|
||||
secure = SECURE_PROTOCOLS.indexOf(endpoint.protocol) >= 0,
|
||||
onConnect = function() { self._onConnect() },
|
||||
netOptions = options.net || {},
|
||||
originTLS = options.tls || {},
|
||||
socketTLS = proxy.origin ? (proxy.tls || {}) : originTLS,
|
||||
self = this;
|
||||
|
||||
netOptions.host = socketTLS.host = endpoint.hostname;
|
||||
netOptions.port = socketTLS.port = port;
|
||||
|
||||
originTLS.ca = originTLS.ca || options.ca;
|
||||
socketTLS.servername = socketTLS.servername || endpoint.hostname;
|
||||
|
||||
this._stream = secure
|
||||
? tls.connect(port, endpoint.hostname, socketTLS, onConnect)
|
||||
: net.connect(port, endpoint.hostname, onConnect);
|
||||
? tls.connect(socketTLS, onConnect)
|
||||
: net.connect(netOptions, onConnect);
|
||||
|
||||
if (proxy.origin) this._configureProxy(proxy, originTLS);
|
||||
|
||||
|
||||
+4
-4
@@ -1,12 +1,12 @@
|
||||
{ "name" : "faye-websocket"
|
||||
, "description" : "Standards-compliant WebSocket server and client"
|
||||
, "homepage" : "http://github.com/faye/faye-websocket-node"
|
||||
, "homepage" : "https://github.com/faye/faye-websocket-node"
|
||||
, "author" : "James Coglan <jcoglan@gmail.com> (http://jcoglan.com/)"
|
||||
, "keywords" : ["websocket", "eventsource"]
|
||||
, "license" : "MIT"
|
||||
|
||||
, "version" : "0.10.0"
|
||||
, "engines" : {"node": ">=0.4.0"}
|
||||
, "version" : "0.11.0"
|
||||
, "engines" : {"node": ">=0.8.0"}
|
||||
, "main" : "./lib/faye/websocket"
|
||||
, "dependencies" : {"websocket-driver": ">=0.5.1"}
|
||||
, "devDependencies" : {"jstest": "", "pace": "", "permessage-deflate": ""}
|
||||
@@ -17,5 +17,5 @@
|
||||
, "url" : "git://github.com/faye/faye-websocket-node.git"
|
||||
}
|
||||
|
||||
, "bugs" : "http://github.com/faye/faye-websocket-node/issues"
|
||||
, "bugs" : "https://github.com/faye/faye-websocket-node/issues"
|
||||
}
|
||||
|
||||
@@ -73,8 +73,11 @@ var WebSocketSteps = test.asyncSteps({
|
||||
this._ws.close()
|
||||
},
|
||||
|
||||
check_open: function(callback) {
|
||||
check_open: function(status, headers, callback) {
|
||||
this.assert( this._open )
|
||||
this.assertEqual( status, this._ws.statusCode )
|
||||
for (var name in headers)
|
||||
this.assertEqual( headers[name], this._ws.headers[name.toLowerCase()] )
|
||||
callback()
|
||||
},
|
||||
|
||||
@@ -154,7 +157,7 @@ test.describe("Client", function() { with(this) {
|
||||
sharedBehavior("socket client", function() { with(this) {
|
||||
it("can open a connection", function() { with(this) {
|
||||
open_socket(socket_url, protocols)
|
||||
check_open()
|
||||
check_open(101, {"Upgrade": "websocket"})
|
||||
check_protocol("echo")
|
||||
}})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user