websocket-driver 0.5.1-java → 0.5.2-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +30 -31
- data/lib/websocket/driver/hybi.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 204e724cade4affb9fa01f98056d0c36e62af18e
|
|
4
|
+
data.tar.gz: 08b5f37a0e84ae7b241cec00f72814ccf3653018
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7de37329327a3dc0af08de66c4fa6eed954fb99a77b0995f3332ffc332470519d2a64aef07337672553a53308fda349c325497b9cf9d6b1e81f50ff8843d9b6c
|
|
7
|
+
data.tar.gz: 9f19147ee7a20731507567a2670836da31c67664eee4abdd94b54afded93f44130ebf905ff2353bdae602f6acc6982fb9d1d814a00c99c3c37eac3364037815e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -7,8 +7,8 @@ code to stream data in and out of it without needing to know anything about how
|
|
|
7
7
|
the protocol actually works. Think of it as a complete WebSocket system with
|
|
8
8
|
pluggable I/O.
|
|
9
9
|
|
|
10
|
-
Due to this design, you get a lot of things for free. In particular, if you
|
|
11
|
-
|
|
10
|
+
Due to this design, you get a lot of things for free. In particular, if you hook
|
|
11
|
+
this module up to some I/O object, it will do all of this for you:
|
|
12
12
|
|
|
13
13
|
* Select the correct server-side driver to talk to the client
|
|
14
14
|
* Generate and send both server- and client-side handshakes
|
|
@@ -68,8 +68,8 @@ Server-side sockets require one additional method:
|
|
|
68
68
|
|
|
69
69
|
To handle a server-side WebSocket connection, you need to check whether the
|
|
70
70
|
request is a WebSocket handshake, and if so create a protocol driver for it.
|
|
71
|
-
You must give the driver an object with the `env`, `url` and `write` methods.
|
|
72
|
-
|
|
71
|
+
You must give the driver an object with the `env`, `url` and `write` methods. A
|
|
72
|
+
simple example might be:
|
|
73
73
|
|
|
74
74
|
```ruby
|
|
75
75
|
require 'websocket/driver'
|
|
@@ -172,9 +172,9 @@ EM.run {
|
|
|
172
172
|
```
|
|
173
173
|
|
|
174
174
|
In the `:connect` event, `@driver.env` is a Rack env representing the request.
|
|
175
|
-
If the request has a body, it will be in the `@driver.env['rack.input']`
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
If the request has a body, it will be in the `@driver.env['rack.input']` stream,
|
|
176
|
+
but only as much of the body as you have so far routed to it using the `parse`
|
|
177
|
+
method.
|
|
178
178
|
|
|
179
179
|
|
|
180
180
|
### Client-side
|
|
@@ -251,11 +251,11 @@ driver = WebSocket::Driver.server(socket, options)
|
|
|
251
251
|
driver = WebSocket::Driver.client(socket, options)
|
|
252
252
|
```
|
|
253
253
|
|
|
254
|
-
The `rack` method returns a driver chosen using the socket's `env`. The
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
254
|
+
The `rack` method returns a driver chosen using the socket's `env`. The `server`
|
|
255
|
+
method returns a driver that will parse an HTTP request and then decide which
|
|
256
|
+
driver to use for it using the `rack` method. The `client` method always returns
|
|
257
|
+
a driver for the RFC version of the protocol with masking enabled on outgoing
|
|
258
|
+
frames.
|
|
259
259
|
|
|
260
260
|
The `options` argument is optional, and is a hash. It may contain the following
|
|
261
261
|
keys:
|
|
@@ -279,9 +279,9 @@ Sets the callback block to execute when the socket becomes open.
|
|
|
279
279
|
|
|
280
280
|
#### `driver.on('message') { |event| }`
|
|
281
281
|
|
|
282
|
-
Sets the callback block to execute when a message is received. `event` will
|
|
283
|
-
|
|
284
|
-
|
|
282
|
+
Sets the callback block to execute when a message is received. `event` will have
|
|
283
|
+
a `data` attribute containing either a string in the case of a text message or
|
|
284
|
+
an array of integers in the case of a binary message.
|
|
285
285
|
|
|
286
286
|
#### `driver.on('error') { |event| }`
|
|
287
287
|
|
|
@@ -304,8 +304,8 @@ framework.
|
|
|
304
304
|
#### `driver.set_header(name, value)`
|
|
305
305
|
|
|
306
306
|
Sets a custom header to be sent as part of the handshake response, either from
|
|
307
|
-
the server or from the client. Must be called before `start`, since this is
|
|
308
|
-
|
|
307
|
+
the server or from the client. Must be called before `start`, since this is when
|
|
308
|
+
the headers are serialized and sent.
|
|
309
309
|
|
|
310
310
|
#### `driver.start`
|
|
311
311
|
|
|
@@ -341,8 +341,8 @@ ping/pong.
|
|
|
341
341
|
|
|
342
342
|
#### `driver.close`
|
|
343
343
|
|
|
344
|
-
Initiates the closing handshake if the socket is still open. For drivers with
|
|
345
|
-
|
|
344
|
+
Initiates the closing handshake if the socket is still open. For drivers with no
|
|
345
|
+
closing handshake, this will result in the immediate execution of the
|
|
346
346
|
`on('close')` callback. For drivers with a closing handshake, this sends a
|
|
347
347
|
closing frame and `emit('close')` will execute when a response is received or a
|
|
348
348
|
protocol error occurs.
|
|
@@ -355,30 +355,29 @@ Returns the WebSocket version in use as a string. Will either be `hixie-75`,
|
|
|
355
355
|
#### `driver.protocol`
|
|
356
356
|
|
|
357
357
|
Returns a string containing the selected subprotocol, if any was agreed upon
|
|
358
|
-
using the `Sec-WebSocket-Protocol` mechanism. This value becomes available
|
|
359
|
-
|
|
358
|
+
using the `Sec-WebSocket-Protocol` mechanism. This value becomes available after
|
|
359
|
+
`emit('open')` has fired.
|
|
360
360
|
|
|
361
361
|
|
|
362
362
|
## License
|
|
363
363
|
|
|
364
364
|
(The MIT License)
|
|
365
365
|
|
|
366
|
-
Copyright (c) 2010-
|
|
366
|
+
Copyright (c) 2010-2015 James Coglan
|
|
367
367
|
|
|
368
368
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
369
369
|
this software and associated documentation files (the 'Software'), to deal in
|
|
370
370
|
the Software without restriction, including without limitation the rights to
|
|
371
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
372
|
-
|
|
373
|
-
|
|
371
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
372
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
373
|
+
subject to the following conditions:
|
|
374
374
|
|
|
375
375
|
The above copyright notice and this permission notice shall be included in all
|
|
376
376
|
copies or substantial portions of the Software.
|
|
377
377
|
|
|
378
378
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
379
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
SOFTWARE.
|
|
379
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
380
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
381
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
382
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
383
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: websocket-driver
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.2
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- James Coglan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2015-02-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: websocket-extensions
|