Compare commits
129 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0528a5d4bd | |||
| fff2a43d63 | |||
| 46806f86f4 | |||
| 32af9bb353 | |||
| 6b66c9fd9d | |||
| 98ddef1e9a | |||
| e316a82f86 | |||
| 0be69bd810 | |||
| b1c5f9049f | |||
| 3eb0a395f3 | |||
| f878a91eb5 | |||
| a2d1fa84e4 | |||
| 4f31ad9851 | |||
| e27ce57c48 | |||
| eb6fac855c | |||
| 4009b68a43 | |||
| 063a1362df | |||
| b4dc4e1411 | |||
| ccaa8ea76e | |||
| 17fae3cc5c | |||
| 8e9f7923ad | |||
| acc3ea9795 | |||
| 01cdfb18db | |||
| 2634e930f9 | |||
| 5f3e939518 | |||
| b85f22e43b | |||
| 1f439f6e9c | |||
| 4b667a1ba5 | |||
| 49eab191cc | |||
| f3749cd347 | |||
| d97556a1dc | |||
| ba4da1077a | |||
| 560a78b18f | |||
| d690bada0b | |||
| 2aef23a530 | |||
| 3148348a3a | |||
| 641212d2b1 | |||
| c00bee21d3 | |||
| 02612c01cd | |||
| dc392490a8 | |||
| 0feee7974c | |||
| 91d8e1ad41 | |||
| c27fee0680 | |||
| 061494bc2c | |||
| 958d3a458f | |||
| 2d945cff5d | |||
| d3340cdd63 | |||
| 0d15d7a3ec | |||
| cdc7f0891b | |||
| f8c5b86e10 | |||
| 53db3d6c25 | |||
| dcb3375dda | |||
| 854c0a9658 | |||
| d753d09372 | |||
| febde17f0e | |||
| c52271c308 | |||
| 8460dd9f03 | |||
| 66fc108591 | |||
| 58491dea2b | |||
| cd220deb74 | |||
| 6c1689a73d | |||
| 29b94290e9 | |||
| 63e16f6341 | |||
| 39eeb1b884 | |||
| e0b2af3936 | |||
| b192dcb47b | |||
| e9daa1d55e | |||
| 6416235e4a | |||
| f52d11b17b | |||
| cd8f337278 | |||
| 76ffac630c | |||
| d2abdb1870 | |||
| f14a49b6eb | |||
| 73284c858c | |||
| ec5838e27e | |||
| 2627293613 | |||
| 4f1eced5e0 | |||
| ca0544fa6a | |||
| 091d98ef0c | |||
| 8d1f652056 | |||
| b779876f07 | |||
| 243e39b7b7 | |||
| 04eda7bc4f | |||
| 43ac090594 | |||
| 1120828003 | |||
| 59911312ac | |||
| 98298acb36 | |||
| 89a9b0d9b8 | |||
| 0e00ea5107 | |||
| d471a6a707 | |||
| 5dc1d7f682 | |||
| dfe361a18b | |||
| 140171307e | |||
| 6c5ef1c884 | |||
| 7ffe738208 | |||
| 2db4ef20ff | |||
| 54cd6f5831 | |||
| 35d9e6998e | |||
| e649b62396 | |||
| d0ec17d6a3 | |||
| 1d3878e3ed | |||
| 97dfaf71cf | |||
| 723f4ce6a7 | |||
| 97b7342538 | |||
| 9d8e5384b7 | |||
| 42ea7fb0a5 | |||
| 03acb154e2 | |||
| b40fc25444 | |||
| 05cc735582 | |||
| 29d07c5002 | |||
| 2118283941 | |||
| 4db640660d | |||
| 4353dd8c36 | |||
| 308f930160 | |||
| 5d7e9ef9a3 | |||
| 07217fe317 | |||
| 29ef6b04a5 | |||
| 1030d38093 | |||
| fa7dcf365c | |||
| 018ef183bf | |||
| b545e8b80f | |||
| 07f5ef6f95 | |||
| 052120b3d5 | |||
| f97fd88e02 | |||
| a8481f8cdd | |||
| d0c9689747 | |||
| e668e64271 | |||
| f0b97a8005 | |||
| e3cc891187 |
@@ -0,0 +1,41 @@
|
||||
on:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node:
|
||||
- '0.8'
|
||||
- '0.10'
|
||||
- '0.12'
|
||||
- '4'
|
||||
- '5'
|
||||
- '6'
|
||||
- '7'
|
||||
- '8'
|
||||
- '9'
|
||||
- '10'
|
||||
- '11'
|
||||
- '12'
|
||||
- '13'
|
||||
- '14'
|
||||
- '15'
|
||||
- '16'
|
||||
name: node.js v${{ matrix.node }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
|
||||
- if: matrix.node == '0.8'
|
||||
run: npm conf set strict-ssl false
|
||||
|
||||
- run: node --version
|
||||
- run: npm install
|
||||
- run: npm test
|
||||
@@ -1 +1,2 @@
|
||||
node_modules
|
||||
package-lock.json
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "0.6"
|
||||
- "0.8"
|
||||
- "0.10"
|
||||
- "0.11"
|
||||
|
||||
+95
-40
@@ -1,84 +1,139 @@
|
||||
### 0.11.4 / 2021-05-24
|
||||
|
||||
- Prevent the client hanging if `close()` is called when already closing
|
||||
|
||||
### 0.11.3 / 2019-06-10
|
||||
|
||||
- Fix a race condition that caused a timeout not to be cancelled immediately
|
||||
when the WebSocket is closed
|
||||
- Change license from MIT to Apache 2.0
|
||||
|
||||
### 0.11.2 / 2019-06-10
|
||||
|
||||
(This version was pulled due to an error when publishing)
|
||||
|
||||
### 0.11.1 / 2017-01-22
|
||||
|
||||
- Forcibly close the I/O stream after a timeout if the peer does not respond
|
||||
after calling `close()`
|
||||
|
||||
### 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.9.4 / 2015-03-08
|
||||
|
||||
- Don't send input to the driver before `start()` is called
|
||||
|
||||
### 0.9.3 / 2015-02-19
|
||||
|
||||
- Make sure the TCP socket is not left open when closing the connection
|
||||
|
||||
### 0.9.2 / 2014-12-21
|
||||
|
||||
- Only emit `error` once, and don't emit it after `close`
|
||||
|
||||
### 0.9.1 / 2014-12-18
|
||||
|
||||
- Check that all options to the WebSocket constructor are recognized
|
||||
|
||||
### 0.9.0 / 2014-12-13
|
||||
|
||||
- Allow protocol extensions to be passed into websocket-extensions
|
||||
|
||||
### 0.8.1 / 2014-11-12
|
||||
|
||||
- Send the correct hostname when upgrading a connection to TLS
|
||||
|
||||
### 0.8.0 / 2014-11-08
|
||||
|
||||
- Support connections via HTTP proxies
|
||||
- Close the connection cleanly if we're still waiting for a handshake response
|
||||
|
||||
### 0.7.3 / 2014-10-04
|
||||
|
||||
- Allow sockets to be closed when they are in any state other than `CLOSED`
|
||||
|
||||
### 0.7.2 / 2013-12-29
|
||||
|
||||
- Make sure the `close` event is emitted by clients on Node v0.10
|
||||
|
||||
### 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
|
||||
|
||||
* Allow the server to send custom headers with EventSource responses
|
||||
|
||||
- Allow the server to send custom headers with EventSource responses
|
||||
|
||||
### 0.6.1 / 2013-07-05
|
||||
|
||||
* Add `ca` option to the client for specifying certificate authorities
|
||||
* Start the server driver asynchronously so that `onopen` handlers can be added
|
||||
|
||||
- Add `ca` option to the client for specifying certificate authorities
|
||||
- Start the server driver asynchronously so that `onopen` handlers can be added
|
||||
|
||||
### 0.6.0 / 2013-05-12
|
||||
|
||||
* Add support for custom headers
|
||||
|
||||
- Add support for custom headers
|
||||
|
||||
### 0.5.0 / 2013-05-05
|
||||
|
||||
* Extract the protocol handlers into the `websocket-driver` library
|
||||
* Support the Node streaming API
|
||||
|
||||
- Extract the protocol handlers into the `websocket-driver` library
|
||||
- Support the Node streaming API
|
||||
|
||||
### 0.4.4 / 2013-02-14
|
||||
|
||||
* Emit the `close` event if TCP is closed before CLOSE frame is acked
|
||||
|
||||
- Emit the `close` event if TCP is closed before CLOSE frame is acked
|
||||
|
||||
### 0.4.3 / 2012-07-09
|
||||
|
||||
* Add `Connection: close` to EventSource response
|
||||
* Handle situations where `request.socket` is undefined
|
||||
|
||||
- Add `Connection: close` to EventSource response
|
||||
- Handle situations where `request.socket` is undefined
|
||||
|
||||
### 0.4.2 / 2012-04-06
|
||||
|
||||
* Add WebSocket error code `1011`.
|
||||
* Handle URLs with no path correctly by sending `GET /`
|
||||
|
||||
- Add WebSocket error code `1011`.
|
||||
- Handle URLs with no path correctly by sending `GET /`
|
||||
|
||||
### 0.4.1 / 2012-02-26
|
||||
|
||||
* Treat anything other than a `Buffer` as a string when calling `send()`
|
||||
|
||||
- Treat anything other than a `Buffer` as a string when calling `send()`
|
||||
|
||||
### 0.4.0 / 2012-02-13
|
||||
|
||||
* Add `ping()` method to server-side `WebSocket` and `EventSource`
|
||||
* Buffer `send()` calls until the draft-76 handshake is complete
|
||||
* Fix HTTPS problems on Node 0.7
|
||||
|
||||
- Add `ping()` method to server-side `WebSocket` and `EventSource`
|
||||
- Buffer `send()` calls until the draft-76 handshake is complete
|
||||
- Fix HTTPS problems on Node 0.7
|
||||
|
||||
### 0.3.1 / 2012-01-16
|
||||
|
||||
* Call `setNoDelay(true)` on `net.Socket` objects to reduce latency
|
||||
|
||||
- Call `setNoDelay(true)` on `net.Socket` objects to reduce latency
|
||||
|
||||
### 0.3.0 / 2012-01-13
|
||||
|
||||
* Add support for `EventSource` connections
|
||||
|
||||
- Add support for `EventSource` connections
|
||||
|
||||
### 0.2.0 / 2011-12-21
|
||||
|
||||
* Add support for `Sec-WebSocket-Protocol` negotiation
|
||||
* Support `hixie-76` close frames and 75/76 ignored segments
|
||||
* Improve performance of HyBi parsing/framing functions
|
||||
* Decouple parsers from TCP and reduce write volume
|
||||
|
||||
- Add support for `Sec-WebSocket-Protocol` negotiation
|
||||
- Support `hixie-76` close frames and 75/76 ignored segments
|
||||
- Improve performance of HyBi parsing/framing functions
|
||||
- Decouple parsers from TCP and reduce write volume
|
||||
|
||||
### 0.1.2 / 2011-12-05
|
||||
|
||||
* Detect closed sockets on the server side when TCP connection breaks
|
||||
* Make `hixie-76` sockets work through HAProxy
|
||||
|
||||
- Detect closed sockets on the server side when TCP connection breaks
|
||||
- Make `hixie-76` sockets work through HAProxy
|
||||
|
||||
### 0.1.1 / 2011-11-30
|
||||
|
||||
* Fix `addEventListener()` interface methods
|
||||
|
||||
- Fix `addEventListener()` interface methods
|
||||
|
||||
### 0.1.0 / 2011-11-27
|
||||
|
||||
* Initial release, based on WebSocket components from Faye
|
||||
|
||||
- Initial release, based on WebSocket components from Faye
|
||||
|
||||
@@ -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).
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
Copyright 2010-2021 James Coglan
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations under the License.
|
||||
@@ -1,23 +1,18 @@
|
||||
# faye-websocket
|
||||
|
||||
* Travis CI build: [](http://travis-ci.org/faye/faye-websocket-node)
|
||||
* Autobahn tests: [server](http://faye.jcoglan.com/autobahn/servers/),
|
||||
[client](http://faye.jcoglan.com/autobahn/clients/)
|
||||
|
||||
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 other than the standard [WebSocket
|
||||
API](http://dev.w3.org/html5/websockets/).
|
||||
[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](https://nodejs.org/) application. It does not provide any abstraction
|
||||
other than the standard [WebSocket
|
||||
API](https://html.spec.whatwg.org/multipage/comms.html#network).
|
||||
|
||||
It also provides an abstraction for handling
|
||||
[EventSource](http://dev.w3.org/html5/eventsource/) connections, which are
|
||||
one-way connections that allow the server to push data to the client. They are
|
||||
based on streaming HTTP responses and can be easier to access via proxies than
|
||||
WebSockets.
|
||||
[EventSource](https://html.spec.whatwg.org/multipage/comms.html#server-sent-events)
|
||||
connections, which are one-way connections that allow the server to push data to
|
||||
the client. They are based on streaming HTTP responses and can be easier to access
|
||||
via proxies than WebSockets.
|
||||
|
||||
|
||||
## Installation
|
||||
@@ -43,11 +38,11 @@ var server = http.createServer();
|
||||
server.on('upgrade', function(request, socket, body) {
|
||||
if (WebSocket.isWebSocket(request)) {
|
||||
var ws = new WebSocket(request, socket, body);
|
||||
|
||||
|
||||
ws.on('message', function(event) {
|
||||
ws.send(event.data);
|
||||
});
|
||||
|
||||
|
||||
ws.on('close', function(event) {
|
||||
console.log('close', event.code, event.reason);
|
||||
ws = null;
|
||||
@@ -77,8 +72,8 @@ 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
|
||||
message string, and an optional callback that fires when a matching pong message
|
||||
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`.
|
||||
|
||||
@@ -117,6 +112,23 @@ ws.on('close', function(event) {
|
||||
The WebSocket client also lets you inspect the status and headers of the
|
||||
handshake response via its `statusCode` and `headers` properties.
|
||||
|
||||
To connect via a proxy, set the `proxy` option to the HTTP origin of the proxy,
|
||||
including any authorization information, custom headers and TLS config you
|
||||
require. Only the `origin` setting is required.
|
||||
|
||||
```js
|
||||
var ws = new WebSocket.Client('ws://www.example.com/', [], {
|
||||
proxy: {
|
||||
origin: 'http://username:password@proxy.example.com',
|
||||
headers: { 'User-Agent': 'node' },
|
||||
tls: { cert: fs.readFileSync('client.crt') }
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
@@ -140,10 +152,26 @@ If the client and server agree on a protocol, both the client- and server-side
|
||||
socket objects expose the selected protocol through the `ws.protocol` property.
|
||||
|
||||
|
||||
## Protocol extensions
|
||||
|
||||
faye-websocket is based on the
|
||||
[websocket-extensions](https://github.com/faye/websocket-extensions-node)
|
||||
framework that allows extensions to be negotiated via the
|
||||
`Sec-WebSocket-Extensions` header. To add extensions to a connection, pass an
|
||||
array of extensions to the `:extensions` option. For example, to add
|
||||
[permessage-deflate](https://github.com/faye/permessage-deflate-node):
|
||||
|
||||
```js
|
||||
var deflate = require('permessage-deflate');
|
||||
|
||||
var ws = new WebSocket(request, socket, body, [], { extensions: [deflate] });
|
||||
```
|
||||
|
||||
|
||||
## Initialization options
|
||||
|
||||
Both the server- and client-side classes allow an options object to be passed
|
||||
in at initialization time, for example:
|
||||
Both the server- and client-side classes allow an options object to be passed in
|
||||
at initialization time, for example:
|
||||
|
||||
```js
|
||||
var ws = new WebSocket(request, socket, body, protocols, options);
|
||||
@@ -153,38 +181,54 @@ var ws = new WebSocket.Client(url, protocols, options);
|
||||
`protocols` is an array of subprotocols as described above, or `null`.
|
||||
`options` is an optional object containing any of these fields:
|
||||
|
||||
* `headers` - an object containing key-value pairs representing HTTP headers to
|
||||
- `extensions` - an array of
|
||||
[websocket-extensions](https://github.com/faye/websocket-extensions-node)
|
||||
compatible extensions, as described above
|
||||
- `headers` - an object containing key-value pairs representing HTTP headers to
|
||||
be sent during the handshake process
|
||||
* `ping` - an integer that sets how often the WebSocket should send ping
|
||||
frames, measured in seconds
|
||||
- `maxLength` - the maximum allowed size of incoming message frames, in bytes.
|
||||
The default value is `2^26 - 1`, or 1 byte short of 64 MiB.
|
||||
- `ping` - an integer that sets how often the WebSocket should send ping frames,
|
||||
measured in seconds
|
||||
|
||||
The client accepts some additional options:
|
||||
|
||||
- `proxy` - settings for a proxy as described above
|
||||
- `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 } }`
|
||||
|
||||
|
||||
## WebSocket API
|
||||
|
||||
Both server- and client-side `WebSocket` objects support the following API.
|
||||
|
||||
* <b>`on('open', function(event) {})`</b> fires when the socket connection is
|
||||
- **`on('open', function(event) {})`** fires when the socket connection is
|
||||
established. Event has no attributes.
|
||||
* <b>`on('message', function(event) {})`</b> fires when the socket receives a
|
||||
message. Event has one attribute, <b>`data`</b>, which is either a `String`
|
||||
(for text frames) or a `Buffer` (for binary frames).
|
||||
* <b>`on('error', function(event) {})`</b> fires when there is a protocol error
|
||||
due to bad data sent by the other peer. This event is purely informational,
|
||||
you do not need to implement error recover.
|
||||
* <b>`on('close', function(event) {})`</b> fires when either the client or the
|
||||
server closes the connection. Event has two optional attributes,
|
||||
<b>`code`</b> and <b>`reason`</b>, that expose the status code and message
|
||||
sent by the peer 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 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.
|
||||
* <b>`version`</b> is a string containing the version of the `WebSocket`
|
||||
protocol the connection is using.
|
||||
* <b>`protocol`</b> is a string (which may be empty) identifying the
|
||||
subprotocol the socket is using.
|
||||
- **`on('message', function(event) {})`** fires when the socket receives a
|
||||
message. Event has one attribute, **`data`**, which is either a `String` (for
|
||||
text frames) or a `Buffer` (for binary frames).
|
||||
- **`on('error', function(event) {})`** fires when there is a protocol error due
|
||||
to bad data sent by the other peer. This event is purely informational, you do
|
||||
not need to implement error recover.
|
||||
- **`on('close', function(event) {})`** fires when either the client or the
|
||||
server closes the connection. Event has two optional attributes, **`code`**
|
||||
and **`reason`**, that expose the status code and message sent by the peer
|
||||
that closed the connection.
|
||||
- **`send(message)`** accepts either a `String` or a `Buffer` and sends a text
|
||||
or binary message over the connection to the other peer.
|
||||
- **`ping(message, function() {})`** sends a ping frame with an optional message
|
||||
and fires the callback when a matching pong is received.
|
||||
- **`close(code, reason)`** closes the connection, sending the given status code
|
||||
and reason text, both of which are optional.
|
||||
- **`version`** is a string containing the version of the `WebSocket` protocol
|
||||
the connection is using.
|
||||
- **`protocol`** is a string (which may be empty) identifying the subprotocol
|
||||
the socket is using.
|
||||
|
||||
|
||||
## Handling EventSource connections in Node
|
||||
@@ -205,18 +249,18 @@ server.on('request', function(request, response) {
|
||||
if (EventSource.isEventSource(request)) {
|
||||
var es = new EventSource(request, response);
|
||||
console.log('open', es.url, es.lastEventId);
|
||||
|
||||
|
||||
// Periodically send messages
|
||||
var loop = setInterval(function() { es.send('Hello') }, 1000);
|
||||
|
||||
|
||||
es.on('close', function() {
|
||||
clearInterval(loop);
|
||||
es = null;
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
// Normal HTTP request
|
||||
response.writeHead(200, {'Content-Type': 'text/plain'});
|
||||
response.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
response.end('Hello');
|
||||
}
|
||||
});
|
||||
@@ -229,34 +273,34 @@ event-type is `'message'` with no ID. For example, to send a `notification`
|
||||
event with ID `99`:
|
||||
|
||||
```js
|
||||
es.send('Breaking News!', {event: 'notification', id: '99'});
|
||||
es.send('Breaking News!', { event: 'notification', id: '99' });
|
||||
```
|
||||
|
||||
The `EventSource` object exposes the following properties:
|
||||
|
||||
* <b>`url`</b> is a string containing the URL the client used to create the
|
||||
- **`url`** is a string containing the URL the client used to create the
|
||||
EventSource.
|
||||
* <b>`lastEventId`</b> is a string containing the last event ID received by the
|
||||
client. You can use this when the client reconnects after a dropped
|
||||
connection to determine which messages need resending.
|
||||
- **`lastEventId`** is a string containing the last event ID received by the
|
||||
client. You can use this when the client reconnects after a dropped connection
|
||||
to determine which messages need resending.
|
||||
|
||||
When you initialize an EventSource with ` new EventSource()`, you can pass
|
||||
configuration options after the `response` parameter. Available options are:
|
||||
|
||||
* <b>`headers`</b> is an object containing custom headers to be set on the
|
||||
- **`headers`** is an object containing custom headers to be set on the
|
||||
EventSource response.
|
||||
* <b>`retry`</b> is a number that tells the client how long (in seconds) it
|
||||
should wait after a dropped connection before attempting to reconnect.
|
||||
* <b>`ping`</b> is a number that tells the server how often (in seconds) to
|
||||
send 'ping' packets to the client to keep the connection open, to defeat
|
||||
timeouts set by proxies. The client will ignore these messages.
|
||||
- **`retry`** is a number that tells the client how long (in seconds) it should
|
||||
wait after a dropped connection before attempting to reconnect.
|
||||
- **`ping`** is a number that tells the server how often (in seconds) to send
|
||||
'ping' packets to the client to keep the connection open, to defeat timeouts
|
||||
set by proxies. The client will ignore these messages.
|
||||
|
||||
For example, this creates a connection that allows access from any origin, pings
|
||||
every 15 seconds and is retryable every 10 seconds if the connection is broken:
|
||||
|
||||
```js
|
||||
var es = new EventSource(request, response, {
|
||||
headers: {'Access-Control-Allow-Origin': '*'},
|
||||
headers: { 'Access-Control-Allow-Origin': '*' },
|
||||
ping: 15,
|
||||
retry: 10
|
||||
});
|
||||
@@ -265,29 +309,3 @@ var es = new EventSource(request, response, {
|
||||
You can send a ping message at any time by calling `es.ping()`. Unlike
|
||||
WebSocket, the client does not send a response to this; it is merely to send
|
||||
some data over the wire to keep the connection alive.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2010-2013 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
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
+26
-25
@@ -1,13 +1,14 @@
|
||||
var WebSocket = require('../lib/faye/websocket'),
|
||||
var WebSocket = require('..').Client,
|
||||
deflate = require('permessage-deflate'),
|
||||
pace = require('pace');
|
||||
|
||||
var host = 'ws://localhost:9001',
|
||||
agent = 'Node ' + process.version,
|
||||
cases = 0,
|
||||
skip = [];
|
||||
var host = 'ws://localhost:9001',
|
||||
agent = encodeURIComponent('node-' + process.version),
|
||||
cases = 0,
|
||||
options = { extensions: [deflate] };
|
||||
|
||||
var socket = new WebSocket.Client(host + '/getCaseCount'),
|
||||
progress;
|
||||
var socket = new WebSocket(host + '/getCaseCount'),
|
||||
url, progress;
|
||||
|
||||
socket.onmessage = function(event) {
|
||||
console.log('Total cases to run: ' + event.data);
|
||||
@@ -15,24 +16,24 @@ socket.onmessage = function(event) {
|
||||
progress = pace(cases);
|
||||
};
|
||||
|
||||
socket.onclose = function() {
|
||||
var runCase = function(n) {
|
||||
var runCase = function(n) {
|
||||
if (n > cases) {
|
||||
url = host + '/updateReports?agent=' + agent;
|
||||
socket = new WebSocket(url);
|
||||
socket.onclose = process.exit;
|
||||
return;
|
||||
}
|
||||
|
||||
url = host + '/runCase?case=' + n + '&agent=' + agent;
|
||||
socket = new WebSocket(url, [], options);
|
||||
socket.pipe(socket);
|
||||
|
||||
socket.on('close', function() {
|
||||
progress.op();
|
||||
|
||||
if (n > cases) {
|
||||
socket = new WebSocket.Client(host + '/updateReports?agent=' + encodeURIComponent(agent));
|
||||
socket.onclose = process.exit;
|
||||
|
||||
} else if (skip.indexOf(n) >= 0) {
|
||||
runCase(n + 1);
|
||||
|
||||
} else {
|
||||
socket = new WebSocket.Client(host + '/runCase?case=' + n + '&agent=' + encodeURIComponent(agent));
|
||||
socket.pipe(socket);
|
||||
socket.on('close', function() { runCase(n + 1) });
|
||||
}
|
||||
};
|
||||
|
||||
runCase(1);
|
||||
runCase(n + 1);
|
||||
});
|
||||
};
|
||||
|
||||
socket.onclose = function() {
|
||||
runCase(1);
|
||||
};
|
||||
|
||||
+24
-16
@@ -1,24 +1,32 @@
|
||||
var WebSocket = require('../lib/faye/websocket'),
|
||||
port = process.argv[2] || 7000,
|
||||
secure = process.argv[3] === 'ssl',
|
||||
scheme = secure ? 'wss' : 'ws',
|
||||
url = scheme + '://localhost:' + port + '/',
|
||||
headers = {Origin: 'http://faye.jcoglan.com'},
|
||||
ws = new WebSocket.Client(url, null, {headers: headers});
|
||||
var WebSocket = require('..').Client,
|
||||
deflate = require('permessage-deflate'),
|
||||
fs = require('fs');
|
||||
|
||||
console.log('Connecting to ' + ws.url);
|
||||
var url = process.argv[2],
|
||||
proxy = process.argv[3],
|
||||
ca = fs.readFileSync(__dirname + '/../spec/server.crt'),
|
||||
tls = { ca: ca };
|
||||
|
||||
ws.onopen = function(event) {
|
||||
console.log('open');
|
||||
ws.send('Hello, WebSocket!');
|
||||
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);
|
||||
ws.send('mic check');
|
||||
};
|
||||
|
||||
ws.onmessage = function(event) {
|
||||
console.log('message', event.data);
|
||||
// ws.close(1002, 'Going away');
|
||||
ws.onclose = function(close) {
|
||||
console.log('[close]', close.code, close.reason);
|
||||
};
|
||||
|
||||
ws.onclose = function(event) {
|
||||
console.log('close', event.code, event.reason);
|
||||
ws.onerror = function(error) {
|
||||
console.log('[error]', error.message);
|
||||
};
|
||||
|
||||
ws.onmessage = function(message) {
|
||||
console.log('[message]', message.data);
|
||||
};
|
||||
|
||||
@@ -18,4 +18,3 @@ backend sockets
|
||||
balance uri depth 2
|
||||
timeout server 120s
|
||||
server socket1 127.0.0.1:7000
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
var ProxyServer = require('../spec/proxy_server');
|
||||
|
||||
var port = process.argv[2],
|
||||
secure = process.argv[3] === 'tls',
|
||||
proxy = new ProxyServer({ debug: true, tls: secure });
|
||||
|
||||
proxy.listen(port);
|
||||
+13
-12
@@ -1,19 +1,21 @@
|
||||
var WebSocket = require('../lib/faye/websocket'),
|
||||
var WebSocket = require('..'),
|
||||
deflate = require('permessage-deflate'),
|
||||
fs = require('fs'),
|
||||
http = require('http'),
|
||||
https = require('https');
|
||||
|
||||
var port = process.argv[2] || 7000,
|
||||
secure = process.argv[3] === 'ssl';
|
||||
var port = process.argv[2] || 7000,
|
||||
secure = process.argv[3] === 'tls',
|
||||
options = { extensions: [deflate], ping: 5 };
|
||||
|
||||
var upgradeHandler = function(request, socket, head) {
|
||||
var ws = new WebSocket(request, socket, head, ['irc', 'xmpp'], {ping: 5});
|
||||
console.log('open', ws.url, ws.version, ws.protocol);
|
||||
var ws = new WebSocket(request, socket, head, ['irc', 'xmpp'], options);
|
||||
console.log('[open]', ws.url, ws.version, ws.protocol, request.headers);
|
||||
|
||||
ws.pipe(ws);
|
||||
|
||||
ws.onclose = function(event) {
|
||||
console.log('close', event.code, event.reason);
|
||||
console.log('[close]', event.code, event.reason);
|
||||
ws = null;
|
||||
};
|
||||
};
|
||||
@@ -25,21 +27,21 @@ var requestHandler = function(request, response) {
|
||||
var es = new WebSocket.EventSource(request, response),
|
||||
time = parseInt(es.lastEventId, 10) || 0;
|
||||
|
||||
console.log('open', es.url, es.lastEventId);
|
||||
console.log('[open]', es.url, es.lastEventId);
|
||||
|
||||
var loop = setInterval(function() {
|
||||
time += 1;
|
||||
es.send('Time: ' + time);
|
||||
setTimeout(function() {
|
||||
if (es) es.send('Update!!', {event: 'update', id: time});
|
||||
if (es) es.send('Update!!', { event: 'update', id: time });
|
||||
}, 1000);
|
||||
}, 2000);
|
||||
|
||||
fs.createReadStream(__dirname + '/haproxy.conf').pipe(es, {end: false});
|
||||
fs.createReadStream(__dirname + '/haproxy.conf').pipe(es, { end: false });
|
||||
|
||||
es.onclose = function() {
|
||||
clearInterval(loop);
|
||||
console.log('close', es.url);
|
||||
console.log('[close]', es.url);
|
||||
es = null;
|
||||
};
|
||||
};
|
||||
@@ -49,7 +51,7 @@ var staticHandler = function(request, response) {
|
||||
|
||||
fs.readFile(__dirname + path, function(err, content) {
|
||||
var status = err ? 404 : 200;
|
||||
response.writeHead(status, {'Content-Type': 'text/html'});
|
||||
response.writeHead(status, { 'Content-Type': 'text/html' });
|
||||
response.write(content || 'Not found');
|
||||
response.end();
|
||||
});
|
||||
@@ -65,4 +67,3 @@ var server = secure
|
||||
server.on('request', requestHandler);
|
||||
server.on('upgrade', upgradeHandler);
|
||||
server.listen(port);
|
||||
|
||||
|
||||
@@ -36,4 +36,3 @@
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -41,4 +41,3 @@
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var Stream = require('stream').Stream,
|
||||
util = require('util'),
|
||||
driver = require('websocket-driver'),
|
||||
@@ -129,4 +131,3 @@ for (var method in instance) EventSource.prototype[method] = instance[method];
|
||||
for (var key in EventTarget) EventSource.prototype[key] = EventTarget[key];
|
||||
|
||||
module.exports = EventSource;
|
||||
|
||||
|
||||
+16
-15
@@ -1,35 +1,33 @@
|
||||
// API references:
|
||||
//
|
||||
// * http://dev.w3.org/html5/websockets/
|
||||
// * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget
|
||||
// * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-event
|
||||
//
|
||||
// * https://html.spec.whatwg.org/multipage/comms.html#network
|
||||
// * https://dom.spec.whatwg.org/#interface-eventtarget
|
||||
// * https://dom.spec.whatwg.org/#interface-event
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util'),
|
||||
driver = require('websocket-driver'),
|
||||
API = require('./websocket/api');
|
||||
|
||||
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;
|
||||
if (!this._stream || !this._stream.writable) return;
|
||||
if (!this._stream.readable) return this._stream.end();
|
||||
|
||||
var catchup = function() { self._stream.removeListener('data', catchup) };
|
||||
this._stream.on('data', catchup);
|
||||
|
||||
this._stream.setTimeout(0);
|
||||
this._stream.setNoDelay(true);
|
||||
|
||||
this._driver.io.write(body);
|
||||
API.call(this, options);
|
||||
|
||||
['error', 'end'].forEach(function(event) {
|
||||
this._stream.on(event, function() { self._finalize('', 1006) });
|
||||
}, this);
|
||||
|
||||
process.nextTick(function() {
|
||||
self._driver.start();
|
||||
self._driver.io.write(body);
|
||||
});
|
||||
};
|
||||
util.inherits(WebSocket, API);
|
||||
@@ -38,9 +36,12 @@ WebSocket.isWebSocket = function(request) {
|
||||
return driver.isWebSocket(request);
|
||||
};
|
||||
|
||||
WebSocket.validateOptions = function(options, validKeys) {
|
||||
driver.validateOptions(options, validKeys);
|
||||
};
|
||||
|
||||
WebSocket.WebSocket = WebSocket;
|
||||
WebSocket.Client = require('./websocket/client');
|
||||
WebSocket.EventSource = require('./eventsource');
|
||||
|
||||
module.exports = WebSocket;
|
||||
|
||||
|
||||
+83
-16
@@ -1,10 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
var Stream = require('stream').Stream,
|
||||
util = require('util'),
|
||||
driver = require('websocket-driver'),
|
||||
EventTarget = require('./api/event_target'),
|
||||
Event = require('./api/event');
|
||||
|
||||
var API = function(options) {
|
||||
options = options || {};
|
||||
driver.validateOptions(options, ['headers', 'extensions', 'maxLength', 'ping', 'proxy', 'tls', 'ca']);
|
||||
|
||||
this.readable = this.writable = true;
|
||||
|
||||
@@ -13,6 +17,11 @@ var API = function(options) {
|
||||
for (var name in headers) this._driver.setHeader(name, headers[name]);
|
||||
}
|
||||
|
||||
var extensions = options.extensions;
|
||||
if (extensions) {
|
||||
[].concat(extensions).forEach(this._driver.addExtension, this._driver);
|
||||
}
|
||||
|
||||
this._ping = options.ping;
|
||||
this._pingId = 0;
|
||||
this.readyState = API.CONNECTING;
|
||||
@@ -25,12 +34,10 @@ var API = function(options) {
|
||||
|
||||
this._driver.on('open', function(e) { self._open() });
|
||||
this._driver.on('message', function(e) { self._receiveMessage(e.data) });
|
||||
this._driver.on('close', function(e) { self._finalize(e.reason, e.code) });
|
||||
this._driver.on('close', function(e) { self._beginClose(e.reason, e.code) });
|
||||
|
||||
this._driver.on('error', function(error) {
|
||||
var event = new Event('error', {message: error.message});
|
||||
event.initEvent('error', false, false);
|
||||
self.dispatchEvent(event);
|
||||
self._emitError(error.message);
|
||||
});
|
||||
this.on('error', function() {});
|
||||
|
||||
@@ -44,8 +51,12 @@ var API = function(options) {
|
||||
self.ping(self._pingId.toString());
|
||||
}, this._ping * 1000);
|
||||
|
||||
this._stream.pipe(this._driver.io);
|
||||
this._driver.io.pipe(this._stream);
|
||||
this._configureStream();
|
||||
|
||||
if (!this._proxy) {
|
||||
this._stream.pipe(this._driver.io);
|
||||
this._driver.io.pipe(this._stream);
|
||||
}
|
||||
};
|
||||
util.inherits(API, Stream);
|
||||
|
||||
@@ -54,6 +65,8 @@ API.OPEN = 1;
|
||||
API.CLOSING = 2;
|
||||
API.CLOSED = 3;
|
||||
|
||||
API.CLOSE_TIMEOUT = 30000;
|
||||
|
||||
var instance = {
|
||||
write: function(data) {
|
||||
return this.send(data);
|
||||
@@ -83,12 +96,44 @@ var instance = {
|
||||
return this._driver.ping(message, callback);
|
||||
},
|
||||
|
||||
close: function() {
|
||||
if (this.readyState === API.OPEN) this.readyState = API.CLOSING;
|
||||
this._driver.close();
|
||||
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.CLOSING) {
|
||||
var self = this;
|
||||
this._closeTimer = setTimeout(function() {
|
||||
self._beginClose('', 1006);
|
||||
}, API.CLOSE_TIMEOUT);
|
||||
}
|
||||
|
||||
if (this.readyState !== API.CLOSED) this.readyState = API.CLOSING;
|
||||
|
||||
this._driver.close(reason, code);
|
||||
},
|
||||
|
||||
_open: function() {
|
||||
_configureStream: function() {
|
||||
var self = this;
|
||||
|
||||
this._stream.setTimeout(0);
|
||||
this._stream.setNoDelay(true);
|
||||
|
||||
['close', 'end'].forEach(function(event) {
|
||||
this._stream.on(event, function() { self._finalizeClose() });
|
||||
}, this);
|
||||
|
||||
this._stream.on('error', function(error) {
|
||||
self._emitError('Network error: ' + self.url + ': ' + error.message);
|
||||
self._finalizeClose();
|
||||
});
|
||||
},
|
||||
|
||||
_open: function() {
|
||||
if (this.readyState !== API.CONNECTING) return;
|
||||
|
||||
this.readyState = API.OPEN;
|
||||
@@ -104,22 +149,45 @@ var instance = {
|
||||
|
||||
if (this.readable) this.emit('data', data);
|
||||
|
||||
var event = new Event('message', {data: data});
|
||||
var event = new Event('message', { data: data });
|
||||
event.initEvent('message', false, false);
|
||||
this.dispatchEvent(event);
|
||||
},
|
||||
|
||||
_finalize: function(reason, code) {
|
||||
if (this.readyState === API.CLOSED) return;
|
||||
_emitError: function(message) {
|
||||
if (this.readyState >= API.CLOSING) return;
|
||||
|
||||
var event = new Event('error', { message: message });
|
||||
event.initEvent('error', false, false);
|
||||
this.dispatchEvent(event);
|
||||
},
|
||||
|
||||
_beginClose: function(reason, code) {
|
||||
if (this.readyState === API.CLOSED) return;
|
||||
this.readyState = API.CLOSING;
|
||||
this._closeParams = [reason, code];
|
||||
|
||||
if (this._stream) {
|
||||
this._stream.destroy();
|
||||
if (!this._stream.readable) this._finalizeClose();
|
||||
}
|
||||
},
|
||||
|
||||
_finalizeClose: function() {
|
||||
if (this.readyState === API.CLOSED) return;
|
||||
this.readyState = API.CLOSED;
|
||||
|
||||
if (this._closeTimer) clearTimeout(this._closeTimer);
|
||||
if (this._pingTimer) clearInterval(this._pingTimer);
|
||||
if (this._stream) this._stream.end();
|
||||
|
||||
if (this.readable) this.emit('end');
|
||||
this.readable = this.writable = false;
|
||||
|
||||
this.readyState = API.CLOSED;
|
||||
var event = new Event('close', {code: code || 1000, reason: reason || ''});
|
||||
var reason = this._closeParams ? this._closeParams[0] : '',
|
||||
code = this._closeParams ? this._closeParams[1] : 1006;
|
||||
|
||||
var event = new Event('close', { code: code, reason: reason });
|
||||
event.initEvent('close', false, false);
|
||||
this.dispatchEvent(event);
|
||||
}
|
||||
@@ -129,4 +197,3 @@ for (var method in instance) API.prototype[method] = instance[method];
|
||||
for (var key in EventTarget) API.prototype[key] = EventTarget[key];
|
||||
|
||||
module.exports = API;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var Event = function(eventType, options) {
|
||||
this.type = eventType;
|
||||
for (var key in options)
|
||||
@@ -18,4 +20,3 @@ Event.AT_TARGET = 2;
|
||||
Event.BUBBLING_PHASE = 3;
|
||||
|
||||
module.exports = Event;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var Event = require('./event');
|
||||
|
||||
var EventTarget = {
|
||||
@@ -26,4 +28,3 @@ var EventTarget = {
|
||||
};
|
||||
|
||||
module.exports = EventTarget;
|
||||
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var util = require('util'),
|
||||
net = require('net'),
|
||||
tls = require('tls'),
|
||||
url = require('url'),
|
||||
driver = require('websocket-driver'),
|
||||
API = require('./api');
|
||||
API = require('./api'),
|
||||
Event = require('./api/event');
|
||||
|
||||
var Client = function(url, protocols, options) {
|
||||
this.url = url;
|
||||
this._uri = require('url').parse(url);
|
||||
this._driver = driver.client(url, {protocols: protocols});
|
||||
var DEFAULT_PORTS = { 'http:': 80, 'https:': 443, 'ws:':80, 'wss:': 443 },
|
||||
SECURE_PROTOCOLS = ['https:', 'wss:'];
|
||||
|
||||
var Client = function(_url, protocols, options) {
|
||||
options = options || {};
|
||||
|
||||
this.url = _url;
|
||||
this._driver = driver.client(this.url, { maxLength: options.maxLength, protocols: protocols });
|
||||
|
||||
['open', 'error'].forEach(function(event) {
|
||||
this._driver.on(event, function() {
|
||||
@@ -16,30 +24,67 @@ var Client = function(url, protocols, options) {
|
||||
});
|
||||
}, this);
|
||||
|
||||
var secure = (this._uri.protocol === 'wss:'),
|
||||
onConnect = function() { self._driver.start() },
|
||||
tlsOptions = {},
|
||||
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;
|
||||
|
||||
if (options && options.ca) tlsOptions.ca = options.ca;
|
||||
netOptions.host = socketTLS.host = endpoint.hostname;
|
||||
netOptions.port = socketTLS.port = port;
|
||||
|
||||
var connection = secure
|
||||
? tls.connect(this._uri.port || 443, this._uri.hostname, tlsOptions, onConnect)
|
||||
: net.createConnection(this._uri.port || 80, this._uri.hostname);
|
||||
originTLS.ca = originTLS.ca || options.ca;
|
||||
socketTLS.servername = socketTLS.servername || endpoint.hostname;
|
||||
|
||||
this._stream = connection;
|
||||
this._stream.setTimeout(0);
|
||||
this._stream.setNoDelay(true);
|
||||
this._stream = secure
|
||||
? tls.connect(socketTLS, onConnect)
|
||||
: net.connect(netOptions, onConnect);
|
||||
|
||||
if (!secure) this._stream.on('connect', onConnect);
|
||||
if (proxy.origin) this._configureProxy(proxy, originTLS);
|
||||
|
||||
API.call(this, options);
|
||||
|
||||
['error', 'end'].forEach(function(event) {
|
||||
this._stream.on(event, function() { self._finalize('', 1006) });
|
||||
}, this);
|
||||
};
|
||||
util.inherits(Client, API);
|
||||
|
||||
module.exports = Client;
|
||||
Client.prototype._onConnect = function() {
|
||||
var worker = this._proxy || this._driver;
|
||||
worker.start();
|
||||
};
|
||||
|
||||
Client.prototype._configureProxy = function(proxy, originTLS) {
|
||||
var uri = url.parse(this.url),
|
||||
secure = SECURE_PROTOCOLS.indexOf(uri.protocol) >= 0,
|
||||
self = this,
|
||||
name;
|
||||
|
||||
this._proxy = this._driver.proxy(proxy.origin);
|
||||
|
||||
if (proxy.headers) {
|
||||
for (name in proxy.headers) this._proxy.setHeader(name, proxy.headers[name]);
|
||||
}
|
||||
|
||||
this._proxy.pipe(this._stream, { end: false });
|
||||
this._stream.pipe(this._proxy);
|
||||
|
||||
this._proxy.on('connect', function() {
|
||||
if (secure) {
|
||||
var options = { socket: self._stream, servername: uri.hostname };
|
||||
for (name in originTLS) options[name] = originTLS[name];
|
||||
self._stream = tls.connect(options);
|
||||
self._configureStream();
|
||||
}
|
||||
self._driver.io.pipe(self._stream);
|
||||
self._stream.pipe(self._driver.io);
|
||||
self._driver.start();
|
||||
});
|
||||
|
||||
this._proxy.on('error', function(error) {
|
||||
self._driver.emit('error', error);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = Client;
|
||||
|
||||
+34
-21
@@ -1,22 +1,35 @@
|
||||
{ "name" : "faye-websocket"
|
||||
, "description" : "Standards-compliant WebSocket server and client"
|
||||
, "homepage" : "http://github.com/faye/faye-websocket-node"
|
||||
, "author" : "James Coglan <jcoglan@gmail.com> (http://jcoglan.com/)"
|
||||
, "keywords" : ["websocket", "eventsource"]
|
||||
, "license" : "MIT"
|
||||
|
||||
, "version" : "0.7.0"
|
||||
, "engines" : {"node": ">=0.4.0"}
|
||||
, "main" : "./lib/faye/websocket"
|
||||
, "dependencies" : {"websocket-driver": ">=0.3.0"}
|
||||
, "devDependencies" : {"jstest": "", "pace": ""}
|
||||
|
||||
, "scripts" : {"test": "jstest spec/runner.js"}
|
||||
|
||||
, "repository" : { "type" : "git"
|
||||
, "url" : "git://github.com/faye/faye-websocket-node.git"
|
||||
}
|
||||
|
||||
, "bugs" : "http://github.com/faye/faye-websocket-node/issues"
|
||||
{
|
||||
"name": "faye-websocket",
|
||||
"description": "Standards-compliant WebSocket server and client",
|
||||
"homepage": "https://github.com/faye/faye-websocket-node",
|
||||
"author": "James Coglan <jcoglan@gmail.com> (http://jcoglan.com/)",
|
||||
"keywords": [
|
||||
"websocket",
|
||||
"eventsource"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"version": "0.11.4",
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"main": "./lib/faye/websocket",
|
||||
"dependencies": {
|
||||
"websocket-driver": ">=0.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jstest": "*",
|
||||
"pace": "*",
|
||||
"permessage-deflate": "*"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jstest spec/runner.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/faye/faye-websocket-node.git"
|
||||
},
|
||||
"bugs": "https://github.com/faye/faye-websocket-node/issues"
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
var fs = require('fs'),
|
||||
http = require('http'),
|
||||
https = require('https');
|
||||
|
||||
var WebSocket = require('../lib/faye/websocket');
|
||||
|
||||
var EchoServer = function(secure) {
|
||||
var server = secure
|
||||
? https.createServer({
|
||||
key: fs.readFileSync(__dirname + '/server.key'),
|
||||
cert: fs.readFileSync(__dirname + '/server.crt')
|
||||
})
|
||||
: http.createServer();
|
||||
|
||||
server.on('upgrade', function(request, socket, head) {
|
||||
var ws = new WebSocket(request, socket, head, ["echo"]);
|
||||
ws.pipe(ws);
|
||||
});
|
||||
|
||||
this._httpServer = server;
|
||||
};
|
||||
|
||||
EchoServer.prototype.listen = function(port) {
|
||||
this._httpServer.listen(port);
|
||||
};
|
||||
|
||||
EchoServer.prototype.stop = function() {
|
||||
this._httpServer.close();
|
||||
};
|
||||
|
||||
module.exports = EchoServer;
|
||||
@@ -1,24 +1,38 @@
|
||||
var Client = require('../../../lib/faye/websocket/client'),
|
||||
test = require('jstest').Test,
|
||||
fs = require('fs')
|
||||
var Client = require('../../../lib/faye/websocket/client'),
|
||||
EchoServer = require('../../echo_server'),
|
||||
ProxyServer = require('../../proxy_server'),
|
||||
test = require('jstest').Test,
|
||||
fs = require('fs')
|
||||
|
||||
var WebSocketSteps = test.asyncSteps({
|
||||
server: function(port, secure, callback) {
|
||||
this._adapter = new EchoServer()
|
||||
this._adapter.listen(port, secure)
|
||||
this._port = port
|
||||
setTimeout(callback, 100)
|
||||
this._echoServer = new EchoServer(secure)
|
||||
this._echoServer.listen(port)
|
||||
process.nextTick(callback)
|
||||
},
|
||||
|
||||
stop: function(callback) {
|
||||
this._adapter.stop()
|
||||
setTimeout(callback, 100)
|
||||
this._echoServer.stop()
|
||||
process.nextTick(callback)
|
||||
},
|
||||
|
||||
proxy: function(port, secure, callback) {
|
||||
this._proxyServer = new ProxyServer({ tls: secure })
|
||||
this._proxyServer.listen(port)
|
||||
process.nextTick(callback)
|
||||
},
|
||||
|
||||
stop_proxy: function(callback) {
|
||||
this._proxyServer.stop()
|
||||
process.nextTick(callback)
|
||||
},
|
||||
|
||||
open_socket: function(url, protocols, callback) {
|
||||
var done = false,
|
||||
self = this,
|
||||
|
||||
tlsOptions = { ca: fs.readFileSync(__dirname + '/../../server.crt') },
|
||||
|
||||
resume = function(open) {
|
||||
if (done) return
|
||||
done = true
|
||||
@@ -27,13 +41,29 @@ var WebSocketSteps = test.asyncSteps({
|
||||
}
|
||||
|
||||
this._ws = new Client(url, protocols, {
|
||||
ca: fs.readFileSync(__dirname + '/../../server.crt')
|
||||
proxy: { origin: this.proxy_url, tls: tlsOptions },
|
||||
tls: tlsOptions
|
||||
})
|
||||
|
||||
this._ws.onopen = function() { resume(true) }
|
||||
this._ws.onclose = function() { resume(false) }
|
||||
},
|
||||
|
||||
open_socket_and_close_it_fast: function(url, protocols, callback) {
|
||||
var self = this
|
||||
|
||||
this._ws = new Client(url, protocols, {
|
||||
ca: fs.readFileSync(__dirname + '/../../server.crt')
|
||||
})
|
||||
|
||||
this._ws.onopen = function() { self._open = self._ever_opened = true }
|
||||
this._ws.onclose = function() { self._open = false }
|
||||
|
||||
this._ws.close()
|
||||
|
||||
callback()
|
||||
},
|
||||
|
||||
close_socket: function(callback) {
|
||||
var self = this
|
||||
this._ws.onclose = function() {
|
||||
@@ -43,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()
|
||||
},
|
||||
|
||||
@@ -53,20 +86,41 @@ var WebSocketSteps = test.asyncSteps({
|
||||
callback()
|
||||
},
|
||||
|
||||
check_never_opened: function(callback) {
|
||||
this.assert( !this._ever_opened )
|
||||
callback()
|
||||
},
|
||||
|
||||
check_readable: function(callback) {
|
||||
this.assert( this._ws.readable )
|
||||
callback()
|
||||
},
|
||||
|
||||
check_not_readable: function(callback) {
|
||||
this.assert( ! this._ws.readable )
|
||||
callback()
|
||||
},
|
||||
|
||||
check_protocol: function(protocol, callback) {
|
||||
this.assertEqual( protocol, this._ws.protocol )
|
||||
callback()
|
||||
},
|
||||
|
||||
listen_for_message: function(callback) {
|
||||
var self = this
|
||||
var time = new Date().getTime(), self = this
|
||||
this._ws.addEventListener('message', function(message) { self._message = message.data })
|
||||
callback()
|
||||
var timer = setInterval(function() {
|
||||
if (self._message || new Date().getTime() - time > 3000) {
|
||||
clearInterval(timer)
|
||||
callback()
|
||||
}
|
||||
}, 100)
|
||||
},
|
||||
|
||||
send_message: function(message, callback) {
|
||||
this._ws.send(message)
|
||||
setTimeout(callback, 100)
|
||||
var ws = this._ws
|
||||
setTimeout(function() { ws.send(message) }, 500)
|
||||
process.nextTick(callback)
|
||||
},
|
||||
|
||||
check_response: function(message, callback) {
|
||||
@@ -77,6 +131,10 @@ var WebSocketSteps = test.asyncSteps({
|
||||
check_no_response: function(callback) {
|
||||
this.assert( !this._message )
|
||||
callback()
|
||||
},
|
||||
|
||||
wait: function (ms, callback) {
|
||||
setTimeout(callback, ms)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -85,23 +143,30 @@ test.describe("Client", function() { with(this) {
|
||||
include(WebSocketSteps)
|
||||
|
||||
before(function() {
|
||||
this.protocols = ["foo", "echo"]
|
||||
this.plain_text_url = "ws://localhost:4180/bayeux"
|
||||
this.secure_url = "wss://localhost:4180/bayeux"
|
||||
this.port = 4180
|
||||
this.protocols = ["foo", "echo"]
|
||||
|
||||
this.plain_text_url = "ws://localhost:4180/bayeux"
|
||||
this.secure_url = "wss://localhost:4180/bayeux"
|
||||
this.port = 4180
|
||||
|
||||
this.plain_text_proxy_url = "http://localhost:4181"
|
||||
this.secure_text_proxy_url = "https://localhost:4181"
|
||||
this.proxy_port = 4181
|
||||
})
|
||||
|
||||
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")
|
||||
}})
|
||||
|
||||
it("can close the connection", function() { with(this) {
|
||||
open_socket(socket_url, protocols)
|
||||
check_readable()
|
||||
close_socket()
|
||||
check_closed()
|
||||
check_not_readable()
|
||||
}})
|
||||
|
||||
describe("in the OPEN state", function() { with(this) {
|
||||
@@ -110,26 +175,26 @@ test.describe("Client", function() { with(this) {
|
||||
}})
|
||||
|
||||
it("can send and receive messages", function() { with(this) {
|
||||
listen_for_message()
|
||||
send_message("I expect this to be echoed")
|
||||
listen_for_message()
|
||||
check_response("I expect this to be echoed")
|
||||
}})
|
||||
|
||||
it("sends numbers as strings", function() { with(this) {
|
||||
listen_for_message()
|
||||
send_message(13)
|
||||
listen_for_message()
|
||||
check_response("13")
|
||||
}})
|
||||
|
||||
it("sends booleans as strings", function() { with(this) {
|
||||
listen_for_message()
|
||||
send_message(false)
|
||||
listen_for_message()
|
||||
check_response("false")
|
||||
}})
|
||||
|
||||
it("sends arrays as strings", function() { with(this) {
|
||||
listen_for_message()
|
||||
send_message([13,14,15])
|
||||
listen_for_message()
|
||||
check_response("13,14,15")
|
||||
}})
|
||||
}})
|
||||
@@ -141,35 +206,70 @@ test.describe("Client", function() { with(this) {
|
||||
}})
|
||||
|
||||
it("cannot send and receive messages", function() { with(this) {
|
||||
listen_for_message()
|
||||
send_message("I expect this to be echoed")
|
||||
listen_for_message()
|
||||
check_no_response()
|
||||
}})
|
||||
}})
|
||||
|
||||
it("can be closed before connecting", function() { with(this) {
|
||||
open_socket_and_close_it_fast(socket_url, protocols)
|
||||
wait(100)
|
||||
check_closed()
|
||||
check_never_opened()
|
||||
check_not_readable()
|
||||
}})
|
||||
}})
|
||||
|
||||
describe("with a plain-text server", function() { with(this) {
|
||||
before(function() {
|
||||
this.socket_url = this.plain_text_url
|
||||
this.blocked_url = this.secure_url
|
||||
})
|
||||
sharedBehavior("socket server", function() { with(this) {
|
||||
describe("with a plain-text server", function() { with(this) {
|
||||
before(function() {
|
||||
this.socket_url = this.plain_text_url
|
||||
this.blocked_url = this.secure_url
|
||||
})
|
||||
|
||||
before(function() { this.server(4180, false) })
|
||||
after (function() { this.stop() })
|
||||
before(function() { this.server(this.port, false) })
|
||||
after (function() { this.stop() })
|
||||
|
||||
behavesLike("socket client")
|
||||
behavesLike("socket client")
|
||||
}})
|
||||
|
||||
describe("with a secure server", function() { with(this) {
|
||||
before(function() {
|
||||
this.socket_url = this.secure_url
|
||||
this.blocked_url = this.plain_text_url
|
||||
})
|
||||
|
||||
before(function() { this.server(this.port, true) })
|
||||
after (function() { this.stop() })
|
||||
|
||||
behavesLike("socket client")
|
||||
}})
|
||||
}})
|
||||
|
||||
describe("with a secure server", function() { with(this) {
|
||||
describe("with no proxy", function() { with(this) {
|
||||
behavesLike("socket server")
|
||||
}})
|
||||
|
||||
describe("with a proxy", function() { with(this) {
|
||||
before(function() {
|
||||
this.socket_url = this.secure_url
|
||||
this.blocked_url = this.plain_text_url
|
||||
this.proxy_url = this.plain_text_proxy_url
|
||||
})
|
||||
|
||||
before(function() { this.server(4180, true) })
|
||||
after (function() { this.stop() })
|
||||
before(function() { this.proxy(this.proxy_port, false) })
|
||||
after (function() { this.stop_proxy() })
|
||||
|
||||
behavesLike("socket client")
|
||||
behavesLike("socket server")
|
||||
}})
|
||||
|
||||
describe("with a secure proxy", function() { with(this) {
|
||||
before(function() {
|
||||
this.proxy_url = this.secure_text_proxy_url
|
||||
})
|
||||
|
||||
before(function() { this.proxy(this.proxy_port, true) })
|
||||
after (function() { this.stop_proxy() })
|
||||
|
||||
behavesLike("socket server")
|
||||
}})
|
||||
}})
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
var fs = require('fs'),
|
||||
http = require('http'),
|
||||
https = require('https'),
|
||||
net = require('net'),
|
||||
url = require('url');
|
||||
|
||||
var AGENTS = { 'http:': http, 'https:': https },
|
||||
PORTS = { 'http:': 80, 'https:': 443 };
|
||||
|
||||
var ProxyServer = function(options) {
|
||||
var proxy = options.tls
|
||||
? https.createServer({
|
||||
key: fs.readFileSync(__dirname + '/server.key'),
|
||||
cert: fs.readFileSync(__dirname + '/server.crt')
|
||||
})
|
||||
: http.createServer();
|
||||
|
||||
options = options || {};
|
||||
|
||||
var onRequest = function(request, response) {
|
||||
if (options.debug) console.log(request.method, request.url, request.headers);
|
||||
|
||||
var uri = url.parse(request.url),
|
||||
agent = AGENTS[uri.protocol],
|
||||
headers = {};
|
||||
|
||||
for (var key in request.headers) {
|
||||
if (key.split('-')[0] !== 'proxy') headers[key] = request.headers[key];
|
||||
}
|
||||
|
||||
var backend = agent.request({
|
||||
method: request.method,
|
||||
host: uri.hostname,
|
||||
port: uri.port || PORTS[uri.protocol],
|
||||
path: uri.path,
|
||||
headers: headers,
|
||||
rejectUnauthorized: false
|
||||
});
|
||||
|
||||
request.pipe(backend);
|
||||
|
||||
backend.on('response', function(resp) {
|
||||
if (options.debug) console.log(resp.statusCode, resp.headers);
|
||||
response.writeHead(resp.statusCode, resp.headers);
|
||||
resp.pipe(response);
|
||||
});
|
||||
};
|
||||
|
||||
var onConnect = function(request, frontend, body) {
|
||||
var parts = request.url.split(':'),
|
||||
backend = net.connect(parts[1], parts[0]);
|
||||
|
||||
frontend.pipe(backend);
|
||||
backend.pipe(frontend);
|
||||
|
||||
backend.on('connect', function() {
|
||||
frontend.write('HTTP/1.1 200 OK\r\n\r\n');
|
||||
});
|
||||
|
||||
if (!options.debug) return;
|
||||
console.log(request.method, request.url, request.headers);
|
||||
|
||||
frontend.on('data', function(data) { console.log('I', data) });
|
||||
backend.on( 'data', function(data) { console.log('O', data) });
|
||||
};
|
||||
|
||||
proxy.on('request', onRequest);
|
||||
proxy.on('connect', onConnect);
|
||||
proxy.on('upgrade', onConnect);
|
||||
|
||||
this._proxy = proxy;
|
||||
};
|
||||
|
||||
ProxyServer.prototype.listen = function(port) {
|
||||
this._proxy.listen(port);
|
||||
};
|
||||
|
||||
ProxyServer.prototype.stop = function() {
|
||||
this._proxy.close();
|
||||
};
|
||||
|
||||
module.exports = ProxyServer;
|
||||
@@ -1,33 +1 @@
|
||||
var WebSocket = require('../lib/faye/websocket'),
|
||||
fs = require('fs'),
|
||||
http = require('http'),
|
||||
https = require('https'),
|
||||
test = require('jstest').Test
|
||||
|
||||
|
||||
EchoServer = function() {}
|
||||
EchoServer.prototype.listen = function(port, ssl) {
|
||||
var server = ssl
|
||||
? https.createServer({
|
||||
key: fs.readFileSync(__dirname + '/server.key'),
|
||||
cert: fs.readFileSync(__dirname + '/server.crt')
|
||||
})
|
||||
: http.createServer()
|
||||
|
||||
server.on('upgrade', function(request, socket, head) {
|
||||
var ws = new WebSocket(request, socket, head, ["echo"])
|
||||
ws.pipe(ws)
|
||||
})
|
||||
this._httpServer = server
|
||||
server.listen(port)
|
||||
}
|
||||
EchoServer.prototype.stop = function(callback, scope) {
|
||||
this._httpServer.on('close', function() {
|
||||
if (callback) callback.call(scope);
|
||||
});
|
||||
this._httpServer.close();
|
||||
}
|
||||
|
||||
|
||||
require('./faye/websocket/client_spec')
|
||||
|
||||
|
||||
+15
-12
@@ -1,14 +1,17 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICKTCCAZICCQDtAJo/efrTvjANBgkqhkiG9w0BAQUFADBZMQswCQYDVQQGEwJV
|
||||
SzETMBEGA1UECBMKU29tZS1TdGF0ZTEPMA0GA1UE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rKAReO9lH2BlJmxP4MjP5vLYpaRUki4PtXuoO5ihbq/dZ65R1Ss+8ZNOI
|
||||
q3gYTvBrD/Rxgj6CfOzXhWhWIcH7BmW32wxGwWSE1Q0AgOj9bdY=
|
||||
-----END RSA PRIVATE KEY-----
|
||||
|
||||
Reference in New Issue
Block a user