mirror of
https://git.steelants.cz/JonatanRek/VUE_GabenParadise.git
synced 2026-10-11 19:34:33 +00:00
Restruct
This commit is contained in:
1 parent
1ba0d7f9ba
commit
8d7722be91
3362 files changed
+13786
-500745
No files matched your search
+45
-32
@@ -10,21 +10,21 @@ pluggable I/O.
|
||||
Due to this design, you get a lot of things for free. In particular, if you hook
|
||||
this module up to some I/O object, it will do all of this for you:
|
||||
|
||||
- Select the correct server-side driver to talk to the client
|
||||
- Generate and send both server- and client-side handshakes
|
||||
- Recognize when the handshake phase completes and the WS protocol begins
|
||||
- Negotiate subprotocol selection based on `Sec-WebSocket-Protocol`
|
||||
- Negotiate and use extensions via the
|
||||
* Select the correct server-side driver to talk to the client
|
||||
* Generate and send both server- and client-side handshakes
|
||||
* Recognize when the handshake phase completes and the WS protocol begins
|
||||
* Negotiate subprotocol selection based on `Sec-WebSocket-Protocol`
|
||||
* Negotiate and use extensions via the
|
||||
[websocket-extensions](https://github.com/faye/websocket-extensions-node)
|
||||
module
|
||||
- Buffer sent messages until the handshake process is finished
|
||||
- Deal with proxies that defer delivery of the draft-76 handshake body
|
||||
- Notify you when the socket is open and closed and when messages arrive
|
||||
- Recombine fragmented messages
|
||||
- Dispatch text, binary, ping, pong and close frames
|
||||
- Manage the socket-closing handshake process
|
||||
- Automatically reply to ping frames with a matching pong
|
||||
- Apply masking to messages sent by the client
|
||||
* Buffer sent messages until the handshake process is finished
|
||||
* Deal with proxies that defer delivery of the draft-76 handshake body
|
||||
* Notify you when the socket is open and closed and when messages arrive
|
||||
* Recombine fragmented messages
|
||||
* Dispatch text, binary, ping, pong and close frames
|
||||
* Manage the socket-closing handshake process
|
||||
* Automatically reply to ping frames with a matching pong
|
||||
* Apply masking to messages sent by the client
|
||||
|
||||
This library was originally extracted from the [Faye](http://faye.jcoglan.com)
|
||||
project but now aims to provide simple WebSocket support for any Node-based
|
||||
@@ -153,8 +153,8 @@ driver.messages.on('data', function(message) {
|
||||
Client drivers have two additional properties for reading the HTTP data that was
|
||||
sent back by the server:
|
||||
|
||||
- `driver.statusCode` - the integer value of the HTTP status code
|
||||
- `driver.headers` - an object containing the response headers
|
||||
* `driver.statusCode` - the integer value of the HTTP status code
|
||||
* `driver.headers` - an object containing the response headers
|
||||
|
||||
|
||||
### HTTP Proxies
|
||||
@@ -177,7 +177,7 @@ var driver = websocket.client('ws://www.example.com/socket'),
|
||||
proxy = driver.proxy('http://username:password@proxy.example.com'),
|
||||
tcp = net.connect(80, 'proxy.example.com');
|
||||
|
||||
tcp.pipe(proxy).pipe(tcp, { end: false });
|
||||
tcp.pipe(proxy).pipe(tcp, {end: false});
|
||||
|
||||
tcp.on('connect', function() {
|
||||
proxy.start();
|
||||
@@ -235,18 +235,18 @@ masking enabled on outgoing frames.
|
||||
The `options` argument is optional, and is an object. It may contain the
|
||||
following fields:
|
||||
|
||||
- `maxLength` - the maximum allowed size of incoming message frames, in bytes.
|
||||
* `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.
|
||||
- `protocols` - an array of strings representing acceptable subprotocols for use
|
||||
* `protocols` - an array of strings representing acceptable subprotocols for use
|
||||
over the socket. The driver will negotiate one of these to use via the
|
||||
`Sec-WebSocket-Protocol` header if supported by the other peer.
|
||||
|
||||
A driver has two duplex streams attached to it:
|
||||
|
||||
- **`driver.io`** - this stream should be attached to an I/O socket like a TCP
|
||||
stream. Pipe incoming TCP chunks to this stream for them to be parsed, and
|
||||
* <b>`driver.io`</b> - this stream should be attached to an I/O socket like a
|
||||
TCP stream. Pipe incoming TCP chunks to this stream for them to be parsed, and
|
||||
pipe this stream back into TCP to send outgoing frames.
|
||||
- **`driver.messages`** - this stream emits messages received over the
|
||||
* <b>`driver.messages`</b> - this stream emits messages received over the
|
||||
WebSocket. Writing to it sends messages to the other peer by emitting frames
|
||||
via the `driver.io` stream.
|
||||
|
||||
@@ -281,17 +281,6 @@ describing the error.
|
||||
Adds a callback to execute when the socket becomes closed. The `event` object
|
||||
has `code` and `reason` attributes.
|
||||
|
||||
#### `driver.on('ping', function(event) {})`
|
||||
|
||||
Adds a callback block to execute when a ping is received. You do not need to
|
||||
handle this by sending a pong frame yourself; the driver handles this for you.
|
||||
|
||||
#### `driver.on('pong', function(event) {})`
|
||||
|
||||
Adds a callback block to execute when a pong is received. If this was in
|
||||
response to a ping you sent, you can also handle this event via the
|
||||
`driver.ping(message, function() { ... })` callback.
|
||||
|
||||
#### `driver.addExtension(extension)`
|
||||
|
||||
Registers a protocol extension whose operation will be negotiated via the
|
||||
@@ -368,3 +357,27 @@ Returns the WebSocket version in use as a string. Will either be `hixie-75`,
|
||||
Returns a string containing the selected subprotocol, if any was agreed upon
|
||||
using the `Sec-WebSocket-Protocol` mechanism. This value becomes available after
|
||||
`emit('open')` has fired.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
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
|
||||
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.
|
||||
Reference in new issue
Block a user