protocol-websocket 0.10.0 → 0.11.0
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
- checksums.yaml.gz.sig +3 -3
- data/lib/protocol/websocket/connection.rb +30 -22
- data/lib/protocol/websocket/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58b07db9f128f30d49b779a04a08624afbeb59abe9cc3e0028ded1e2d5e6a7f3
|
4
|
+
data.tar.gz: 646c2a5004051f46d6f4872fec0842d695d6e4a1b2273421bc164293315df4e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1f28c28daa4dc109df788ae226c4b9a0a1081d20a2316a4e23ff48e1632dd9662a32c2bad2573fed32cde1624c7ab7c23a53b805e946068a70543f93b188cbf
|
7
|
+
data.tar.gz: 0d64b3c9f3d809bd6b965b15780be053c15cfc37ff7fc5c66d0d7dc73e614821550ee25746f6a4b28b9c6f69603254daa3f4bd83b63e4cd5dbe8b4f223be9ab6
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
l��ҭ��V4�$C==N�*$���D�e�Z�8j�k��.�a<!���Ih�Z��8�mˋ4����m@�"sk�58Gؒ�
|
2
|
+
=~�{�!�ַu�WY����M�F�
|
3
|
+
����nG~�b�o�4#�3��響`�K���Y�����9.�λ��J��b�虎�;r1�5�����y,0�J��od���I���� y���X�\V +��|R-g�7��E�t����n����c���q��n�5�8u{'��6wY1�v��L���Vڤ�l��!ߤ���$��Ի�.b�$����b'bٳ��'HbJ^�!���Q��Yeb���j�܍=F�-8�!VT��o����*��$���g�d�&�O��-I|HB
|
@@ -55,12 +55,32 @@ module Protocol
|
|
55
55
|
@framer.flush
|
56
56
|
end
|
57
57
|
|
58
|
+
def open!
|
59
|
+
@state = :open
|
60
|
+
|
61
|
+
return self
|
62
|
+
end
|
63
|
+
|
64
|
+
def close!(...)
|
65
|
+
@state = :closed
|
66
|
+
|
67
|
+
return self
|
68
|
+
end
|
69
|
+
|
58
70
|
def closed?
|
59
71
|
@state == :closed
|
60
72
|
end
|
61
73
|
|
62
|
-
def close(
|
63
|
-
|
74
|
+
def close(...)
|
75
|
+
unless @state == :closed
|
76
|
+
close!
|
77
|
+
|
78
|
+
begin
|
79
|
+
send_close(...)
|
80
|
+
rescue
|
81
|
+
# Ignore.
|
82
|
+
end
|
83
|
+
end
|
64
84
|
|
65
85
|
@framer.close
|
66
86
|
end
|
@@ -80,11 +100,11 @@ module Protocol
|
|
80
100
|
|
81
101
|
return frame
|
82
102
|
rescue ProtocolError => error
|
83
|
-
|
103
|
+
close(error.code, error.message)
|
84
104
|
|
85
105
|
raise
|
86
106
|
rescue
|
87
|
-
|
107
|
+
close(Error::PROTOCOL_ERROR, $!.message)
|
88
108
|
|
89
109
|
raise
|
90
110
|
end
|
@@ -120,11 +140,13 @@ module Protocol
|
|
120
140
|
end
|
121
141
|
|
122
142
|
def receive_close(frame)
|
123
|
-
@state = :closed
|
124
|
-
|
125
143
|
code, reason = frame.unpack
|
126
144
|
|
127
|
-
|
145
|
+
# If we're already closed, then we don't need to send a close frame. Otherwise, according to the RFC, we should echo the close frame. However, it's possible it will fail to send if the connection is already closed.
|
146
|
+
unless @state == :closed
|
147
|
+
close!
|
148
|
+
send_close(code, reason)
|
149
|
+
end
|
128
150
|
|
129
151
|
if code and code != Error::NO_ERROR
|
130
152
|
raise ClosedError.new reason, code
|
@@ -142,18 +164,6 @@ module Protocol
|
|
142
164
|
end
|
143
165
|
end
|
144
166
|
|
145
|
-
def open!
|
146
|
-
@state = :open
|
147
|
-
|
148
|
-
return self
|
149
|
-
end
|
150
|
-
|
151
|
-
def close!
|
152
|
-
@state = :closed
|
153
|
-
|
154
|
-
return self
|
155
|
-
end
|
156
|
-
|
157
167
|
def receive_ping(frame)
|
158
168
|
if @state != :closed
|
159
169
|
write_frame(frame.reply(mask: @mask))
|
@@ -198,8 +208,6 @@ module Protocol
|
|
198
208
|
|
199
209
|
self.write_frame(frame)
|
200
210
|
self.flush
|
201
|
-
|
202
|
-
@state = :closed
|
203
211
|
end
|
204
212
|
|
205
213
|
# Write a message to the connection.
|
@@ -237,7 +245,7 @@ module Protocol
|
|
237
245
|
end
|
238
246
|
end
|
239
247
|
rescue ProtocolError => error
|
240
|
-
|
248
|
+
close(error.code, error.message)
|
241
249
|
|
242
250
|
raise
|
243
251
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protocol-websocket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -41,7 +41,7 @@ cert_chain:
|
|
41
41
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
42
42
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
43
43
|
-----END CERTIFICATE-----
|
44
|
-
date: 2023-
|
44
|
+
date: 2023-03-07 00:00:00.000000000 Z
|
45
45
|
dependencies:
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: protocol-http
|
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
163
|
- !ruby/object:Gem::Version
|
164
164
|
version: '0'
|
165
165
|
requirements: []
|
166
|
-
rubygems_version: 3.4.
|
166
|
+
rubygems_version: 3.4.6
|
167
167
|
signing_key:
|
168
168
|
specification_version: 4
|
169
169
|
summary: A low level implementation of the WebSocket protocol.
|
metadata.gz.sig
CHANGED
Binary file
|