websocket-driver 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/websocket/driver.rb +15 -5
- 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: 0b046fb6e3d1a05a5d1af3e0e1c328d1b647e01a
|
4
|
+
data.tar.gz: 901e817816e37309039527b775ba7c99a67efd54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 419cc80493b66e1ebfc1abd0e05f9a4ae8c49327bf2d0dd554ababcf95e2d846b32a968d2245e5670d5202a0e4a644abb7bdc491f27fbf5980f33e91cdc208b5
|
7
|
+
data.tar.gz: 990a461eadf0cfe36c263019012c506d565874d5005ff6b5d5a6104b01dc11c573f4855b9ded57a110ff9e6276ad8ecf5360ed3b1a1ec0a3dafbe3d543ca0b15
|
data/CHANGELOG.md
CHANGED
data/lib/websocket/driver.rb
CHANGED
@@ -40,12 +40,13 @@ module WebSocket
|
|
40
40
|
MAX_LENGTH = 0x3ffffff
|
41
41
|
STATES = [:connecting, :open, :closing, :closed]
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
ConnectEvent = Struct.new(nil)
|
44
|
+
OpenEvent = Struct.new(nil)
|
45
|
+
MessageEvent = Struct.new(:data)
|
46
|
+
CloseEvent = Struct.new(:code, :reason)
|
47
47
|
|
48
|
-
|
48
|
+
ProtocolError = Class.new(StandardError)
|
49
|
+
ConfigurationError = Class.new(ArgumentError)
|
49
50
|
|
50
51
|
autoload :Client, root + '/client'
|
51
52
|
autoload :Draft75, root + '/draft75'
|
@@ -61,6 +62,7 @@ module WebSocket
|
|
61
62
|
|
62
63
|
def initialize(socket, options = {})
|
63
64
|
super()
|
65
|
+
Driver.validate_options(options, [:max_length, :masking, :require_masking, :protocols])
|
64
66
|
|
65
67
|
@socket = socket
|
66
68
|
@options = options
|
@@ -158,6 +160,14 @@ module WebSocket
|
|
158
160
|
string
|
159
161
|
end
|
160
162
|
|
163
|
+
def self.validate_options(options, valid_keys)
|
164
|
+
options.keys.each do |key|
|
165
|
+
unless valid_keys.include?(key)
|
166
|
+
raise ConfigurationError, "Unrecognized option: #{key.inspect}"
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
161
171
|
def self.valid_utf8?(string)
|
162
172
|
if defined?(UTF8_MATCH)
|
163
173
|
UTF8_MATCH =~ string ? true : false
|
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.1
|
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-
|
11
|
+
date: 2014-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket-extensions
|