websocket-driver 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b046fb6e3d1a05a5d1af3e0e1c328d1b647e01a
4
- data.tar.gz: 901e817816e37309039527b775ba7c99a67efd54
3
+ metadata.gz: 355c38f7905603a5432ff7ade68f18b103623a9f
4
+ data.tar.gz: e133de9ac38c9b6b82a3e2142947f64c4a2b022c
5
5
  SHA512:
6
- metadata.gz: 419cc80493b66e1ebfc1abd0e05f9a4ae8c49327bf2d0dd554ababcf95e2d846b32a968d2245e5670d5202a0e4a644abb7bdc491f27fbf5980f33e91cdc208b5
7
- data.tar.gz: 990a461eadf0cfe36c263019012c506d565874d5005ff6b5d5a6104b01dc11c573f4855b9ded57a110ff9e6276ad8ecf5360ed3b1a1ec0a3dafbe3d543ca0b15
6
+ metadata.gz: 2d236fe96b7f63e1f029c2afe0d3817c3354792266d5a77efded6ce48a19b695f49c2c273aa836bbbed2d87256f5edd3d6b8199fa26ee77c8b465214f0cb04f6
7
+ data.tar.gz: 6bafd2375b6ddda1063161f0714a3c119589f431795ac0da8b1da8f13f2134903ebf534e5d7a66edf94a9af50aa6eb1d3f67aecc99105c39a3aef490860618c9
@@ -1,3 +1,7 @@
1
+ ### 0.5.2 / 2015-02-19
2
+
3
+ * Don't emit multiple `error` events
4
+
1
5
  ### 0.5.1 / 2014-12-18
2
6
 
3
7
  * Don't allow drivers to be created with unrecognized options
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
- hook this module up to some I/O object, it will do all of this for you:
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
- A simple example might be:
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
- stream, but only as much of the body as you have so far routed to it using the
177
- `parse` method.
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
- `server` method returns a driver that will parse an HTTP request and then
256
- decide which driver to use for it using the `rack` method. The `client` method
257
- always returns a driver for the RFC version of the protocol with masking
258
- enabled on outgoing frames.
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
- have a `data` attribute containing either a string in the case of a text
284
- message or an array of integers in the case of a binary message.
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
- when the headers are serialized and sent.
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
- no closing handshake, this will result in the immediate execution of the
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
- after `emit('open')` has fired.
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-2014 James Coglan
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
- of the Software, and to permit persons to whom the Software is furnished to do
373
- so, subject to the following conditions:
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
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
381
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
382
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
383
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
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.
@@ -255,6 +255,7 @@ module WebSocket
255
255
  end
256
256
 
257
257
  def fail(type, message)
258
+ return if @ready_state > 1
258
259
  emit(:error, ProtocolError.new(message))
259
260
  shutdown(ERRORS[type], message)
260
261
  end
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.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Coglan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-18 00:00:00.000000000 Z
11
+ date: 2015-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket-extensions
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  version: '0'
137
137
  requirements: []
138
138
  rubyforge_project:
139
- rubygems_version: 2.2.2
139
+ rubygems_version: 2.4.5
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: WebSocket protocol handler with pluggable I/O