protocol-websocket 0.9.0 → 0.10.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/binary_frame.rb +5 -19
- data/lib/protocol/websocket/close_frame.rb +15 -28
- data/lib/protocol/websocket/connection.rb +16 -22
- data/lib/protocol/websocket/continuation_frame.rb +4 -19
- data/lib/protocol/websocket/error.rb +4 -19
- data/lib/protocol/websocket/extension/compression/constants.rb +4 -19
- data/lib/protocol/websocket/extension/compression/deflate.rb +10 -24
- data/lib/protocol/websocket/extension/compression/inflate.rb +12 -22
- data/lib/protocol/websocket/extension/compression.rb +6 -21
- data/lib/protocol/websocket/extensions.rb +4 -19
- data/lib/protocol/websocket/frame.rb +10 -23
- data/lib/protocol/websocket/framer.rb +5 -20
- data/lib/protocol/websocket/headers.rb +4 -19
- data/lib/protocol/websocket/json_message.rb +32 -0
- data/lib/protocol/websocket/message.rb +6 -20
- data/lib/protocol/websocket/ping_frame.rb +4 -19
- data/lib/protocol/websocket/pong_frame.rb +4 -19
- data/lib/protocol/websocket/text_frame.rb +5 -19
- data/lib/protocol/websocket/version.rb +5 -20
- data/lib/protocol/websocket.rb +4 -19
- data/license.md +25 -0
- data/readme.md +19 -0
- data.tar.gz.sig +0 -0
- metadata +9 -6
- 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: 625dad3dc10a593cb806a3cf3174414ffab74cd1b26107e520f6c938d66713bc
|
4
|
+
data.tar.gz: 6f73f9dd24b1f235310ae26afdee3cb85901d568b9414d509280cf20c38b42ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 128be3205862ad76b5e728de4dc9aa65dd913e903a5acdfd41267b49267f7b5c30429d8893177503ee384aed81b327b57af446dbd8ed5ac2c02b3a45111f25bf
|
7
|
+
data.tar.gz: 0a7a73d4d35ce39e6b38c5d3c78af3bb1c8326605db6f7ce665cd34c6538a5941b7994f6b8c70a597fb8ae16db8c86b4f83e95189f746c2b70ffd93ec888de2b
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
��7c4W����;��F��!_����U���?���>���/�G�EF3�|�Q��G�y�eyIj1��lx�2@s���c�h��ä��n Pk�j��'�~������0�ϣ�����9D]Ǐ:�*}�� s 2�=� k�x���*��Wo�� 4�����H/[PU�������e#^od)����A���#HϢ��RvK�'Y�Aީ)�[���_M��}��2���̒jҋ��d� ���d�/9�
|
2
|
+
`�Z>�'�Q� ��G)r6��@.�Q%?>���HN�?�����U|n�*Fڊ�O�8�%6)�n�ʉ|�j����h����G�V0$�V��"(�$]��D�u�!�1��
|
3
|
+
3C����U���7�
|
@@ -1,22 +1,8 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
5
|
+
# Copyright, 2021, by Aurora Nockert.
|
20
6
|
|
21
7
|
require_relative 'frame'
|
22
8
|
require_relative 'message'
|
@@ -1,22 +1,8 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
5
|
+
# Copyright, 2021, by Aurora Nockert.
|
20
6
|
|
21
7
|
require_relative 'frame'
|
22
8
|
|
@@ -31,38 +17,39 @@ module Protocol
|
|
31
17
|
|
32
18
|
case data.length
|
33
19
|
when 0
|
34
|
-
[nil,
|
20
|
+
[nil, nil]
|
35
21
|
when 1
|
36
|
-
raise ProtocolError, "
|
22
|
+
raise ProtocolError, "Invalid close frame length!"
|
37
23
|
else
|
38
24
|
code, reason = *data.unpack(FORMAT)
|
39
25
|
|
40
26
|
case code
|
41
27
|
when 0 .. 999, 1005 .. 1006, 1015, 5000 .. 0xFFFF
|
42
|
-
raise ProtocolError, "
|
28
|
+
raise ProtocolError, "Invalid close code!"
|
43
29
|
when 1004, 1016 .. 2999
|
44
|
-
raise ProtocolError, "
|
30
|
+
raise ProtocolError, "Reserved close code!"
|
45
31
|
end
|
46
32
|
|
47
33
|
reason.force_encoding(Encoding::UTF_8)
|
48
34
|
|
49
35
|
unless reason.valid_encoding?
|
50
|
-
raise ProtocolError, "
|
36
|
+
raise ProtocolError, "Invalid UTF-8 in close reason!"
|
51
37
|
end
|
52
38
|
|
53
39
|
[code, reason]
|
54
40
|
end
|
55
41
|
end
|
56
42
|
|
57
|
-
|
43
|
+
# If code is missing, reason is ignored.
|
44
|
+
def pack(code = nil, reason = nil)
|
58
45
|
if code
|
59
|
-
|
46
|
+
if reason and reason.encoding != Encoding::UTF_8
|
60
47
|
reason = reason.encode(Encoding::UTF_8)
|
61
48
|
end
|
62
49
|
|
63
|
-
super
|
50
|
+
super([code, reason].pack(FORMAT))
|
64
51
|
else
|
65
|
-
super
|
52
|
+
super()
|
66
53
|
end
|
67
54
|
end
|
68
55
|
|
@@ -1,22 +1,9 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
5
|
+
# Copyright, 2019, by William T. Nelson.
|
6
|
+
# Copyright, 2021, by Aurora Nockert.
|
20
7
|
|
21
8
|
require_relative 'framer'
|
22
9
|
require 'securerandom'
|
@@ -56,10 +43,10 @@ module Protocol
|
|
56
43
|
|
57
44
|
def reserve!(bit)
|
58
45
|
if (@reserved & bit).zero?
|
59
|
-
raise "Unable to use #{bit}!"
|
46
|
+
raise ArgumentError, "Unable to use #{bit}!"
|
60
47
|
end
|
61
48
|
|
62
|
-
@reserved
|
49
|
+
@reserved &= ~bit
|
63
50
|
|
64
51
|
return true
|
65
52
|
end
|
@@ -161,6 +148,12 @@ module Protocol
|
|
161
148
|
return self
|
162
149
|
end
|
163
150
|
|
151
|
+
def close!
|
152
|
+
@state = :closed
|
153
|
+
|
154
|
+
return self
|
155
|
+
end
|
156
|
+
|
164
157
|
def receive_ping(frame)
|
165
158
|
if @state != :closed
|
166
159
|
write_frame(frame.reply(mask: @mask))
|
@@ -174,7 +167,7 @@ module Protocol
|
|
174
167
|
end
|
175
168
|
|
176
169
|
def receive_frame(frame)
|
177
|
-
|
170
|
+
raise ProtocolError, "Unhandled frame: #{frame}"
|
178
171
|
end
|
179
172
|
|
180
173
|
def pack_text_frame(buffer, **options)
|
@@ -212,6 +205,7 @@ module Protocol
|
|
212
205
|
# Write a message to the connection.
|
213
206
|
# @parameter message [Message] The message to send.
|
214
207
|
def write(message, **options)
|
208
|
+
# This is a compatibility shim for the previous implementation. We may want to eventually deprecate this use case... or maybe it's convenient enough to leave it around.
|
215
209
|
if message.is_a?(String)
|
216
210
|
if message.encoding == Encoding::UTF_8
|
217
211
|
return send_text(message, **options)
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'frame'
|
22
7
|
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require 'protocol/http/error'
|
22
7
|
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require 'zlib'
|
22
7
|
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'constants'
|
22
7
|
|
@@ -51,16 +36,17 @@ module Protocol
|
|
51
36
|
@level = level
|
52
37
|
@memory_level = memory_level
|
53
38
|
@strategy = strategy
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
39
|
+
|
40
|
+
# This is handled during negotiation:
|
41
|
+
# if window_bits < MINIMUM_WINDOW_BITS
|
42
|
+
# window_bits = MINIMUM_WINDOW_BITS
|
43
|
+
# end
|
58
44
|
|
59
45
|
@window_bits = window_bits
|
60
46
|
@context_takeover = context_takeover
|
61
47
|
end
|
62
48
|
|
63
|
-
def
|
49
|
+
def to_s
|
64
50
|
"#<#{self.class} window_bits=#{@window_bits} context_takeover=#{@context_takeover}>"
|
65
51
|
end
|
66
52
|
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'constants'
|
22
7
|
|
@@ -48,14 +33,19 @@ module Protocol
|
|
48
33
|
|
49
34
|
@inflate = nil
|
50
35
|
|
51
|
-
|
52
|
-
|
53
|
-
|
36
|
+
# This is handled during negotiation:
|
37
|
+
# if window_bits < MINIMUM_WINDOW_BITS
|
38
|
+
# window_bits = MINIMUM_WINDOW_BITS
|
39
|
+
# end
|
54
40
|
|
55
41
|
@window_bits = window_bits
|
56
42
|
@context_takeover = context_takeover
|
57
43
|
end
|
58
44
|
|
45
|
+
def to_s
|
46
|
+
"#<#{self.class} window_bits=#{@window_bits} context_takeover=#{@context_takeover}>"
|
47
|
+
end
|
48
|
+
|
59
49
|
attr :window_bits
|
60
50
|
attr :context_takeover
|
61
51
|
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'compression/constants'
|
22
7
|
require_relative 'compression/inflate'
|
@@ -86,7 +71,7 @@ module Protocol
|
|
86
71
|
options[:client_max_window_bits] = value
|
87
72
|
header << "client_max_window_bits=#{value}"
|
88
73
|
else
|
89
|
-
raise ArgumentError, "Unknown option #{key}!"
|
74
|
+
raise ArgumentError, "Unknown option: #{key}!"
|
90
75
|
end
|
91
76
|
end
|
92
77
|
|
@@ -117,7 +102,7 @@ module Protocol
|
|
117
102
|
when "client_max_window_bits"
|
118
103
|
options[:client_max_window_bits] = Integer(value || 15)
|
119
104
|
else
|
120
|
-
raise ArgumentError, "Unknown option #{key}!"
|
105
|
+
raise ArgumentError, "Unknown option: #{key}!"
|
121
106
|
end
|
122
107
|
end
|
123
108
|
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'extension/compression'
|
22
7
|
require_relative 'headers'
|
@@ -1,22 +1,9 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
5
|
+
# Copyright, 2019, by Soumya.
|
6
|
+
# Copyright, 2021, by Aurora Nockert.
|
20
7
|
|
21
8
|
require_relative 'error'
|
22
9
|
|
@@ -99,7 +86,7 @@ module Protocol
|
|
99
86
|
attr_accessor :length
|
100
87
|
attr_accessor :payload
|
101
88
|
|
102
|
-
def pack(data)
|
89
|
+
def pack(data = "")
|
103
90
|
length = data.bytesize
|
104
91
|
|
105
92
|
if length.bit_length > 63
|
@@ -148,9 +135,9 @@ module Protocol
|
|
148
135
|
opcode = byte & 0b0000_1111
|
149
136
|
|
150
137
|
if (0x3 .. 0x7).include?(opcode)
|
151
|
-
raise ProtocolError, "
|
138
|
+
raise ProtocolError, "Non-control opcode = #{opcode} is reserved!"
|
152
139
|
elsif (0xB .. 0xF).include?(opcode)
|
153
|
-
raise ProtocolError, "
|
140
|
+
raise ProtocolError, "Control opcode = #{opcode} is reserved!"
|
154
141
|
end
|
155
142
|
|
156
143
|
return finished, flags, opcode
|
@@ -190,7 +177,7 @@ module Protocol
|
|
190
177
|
payload = stream.read(length) or raise EOFError, "Could not read payload!"
|
191
178
|
|
192
179
|
if payload.bytesize != length
|
193
|
-
raise EOFError, "Incorrect payload length: #{@length} != #{
|
180
|
+
raise EOFError, "Incorrect payload length: #{@length} != #{payload.bytesize}!"
|
194
181
|
end
|
195
182
|
|
196
183
|
return self.new(finished, payload, flags: flags, opcode: opcode, mask: mask)
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'frame'
|
22
7
|
|
@@ -75,7 +60,7 @@ module Protocol
|
|
75
60
|
end
|
76
61
|
|
77
62
|
def read_header
|
78
|
-
if buffer = @stream.read(1)
|
63
|
+
if buffer = @stream.read(1) and buffer.bytesize == 1
|
79
64
|
return Frame.parse_header(buffer)
|
80
65
|
end
|
81
66
|
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require 'digest/sha1'
|
22
7
|
require 'securerandom'
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2023, by Samuel Williams.
|
5
|
+
|
6
|
+
require 'json'
|
7
|
+
|
8
|
+
require_relative 'message'
|
9
|
+
|
10
|
+
module Protocol
|
11
|
+
module WebSocket
|
12
|
+
class JSONMessage < TextMessage
|
13
|
+
def self.wrap(message)
|
14
|
+
if message.is_a?(TextMessage)
|
15
|
+
self.new(message.buffer)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.generate(object)
|
20
|
+
self.new(JSON.generate(object))
|
21
|
+
end
|
22
|
+
|
23
|
+
def parse(symbolize_names: true, **options)
|
24
|
+
JSON.parse(@buffer, symbolize_names: symbolize_names, **options)
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_h
|
28
|
+
parse.to_h
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'frame'
|
22
7
|
|
@@ -33,8 +18,9 @@ module Protocol
|
|
33
18
|
@buffer.bytesize
|
34
19
|
end
|
35
20
|
|
21
|
+
# This can be helpful for writing tests.
|
36
22
|
def == other
|
37
|
-
@buffer == other
|
23
|
+
@buffer == other.to_str
|
38
24
|
end
|
39
25
|
|
40
26
|
def to_str
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'frame'
|
22
7
|
require_relative 'pong_frame'
|
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'frame'
|
22
7
|
|
@@ -1,22 +1,8 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
5
|
+
# Copyright, 2021, by Aurora Nockert.
|
20
6
|
|
21
7
|
require_relative 'frame'
|
22
8
|
require_relative 'message'
|
@@ -1,25 +1,10 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
module Protocol
|
22
7
|
module WebSocket
|
23
|
-
VERSION = "0.
|
8
|
+
VERSION = "0.10.0"
|
24
9
|
end
|
25
10
|
end
|
data/lib/protocol/websocket.rb
CHANGED
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
20
5
|
|
21
6
|
require_relative 'websocket/version'
|
22
7
|
require_relative 'websocket/framer'
|
data/license.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright, 2019-2023, by Samuel Williams.
|
4
|
+
Copyright, 2019, by Soumya.
|
5
|
+
Copyright, 2019, by William T. Nelson.
|
6
|
+
Copyright, 2020, by Olle Jonsson.
|
7
|
+
Copyright, 2021, by Aurora Nockert.
|
8
|
+
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
11
|
+
in the Software without restriction, including without limitation the rights
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
14
|
+
furnished to do so, subject to the following conditions:
|
15
|
+
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
17
|
+
copies or substantial portions of the Software.
|
18
|
+
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
25
|
+
SOFTWARE.
|
data/readme.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Protocol::WebSocket
|
2
|
+
|
3
|
+
Provides a low-level implementation of the WebSocket protocol according to [RFC6455](https://tools.ietf.org/html/rfc6455). It only implements the latest stable version (13).
|
4
|
+
|
5
|
+
[](https://github.com/socketry/protocol-websocket/actions?workflow=Test)
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
Please see the [project documentation](https://socketry.github.io/protocol-websocket).
|
10
|
+
|
11
|
+
## Contributing
|
12
|
+
|
13
|
+
We welcome contributions to this project.
|
14
|
+
|
15
|
+
1. Fork it.
|
16
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
17
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
18
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
19
|
+
5. Create new Pull Request.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protocol-websocket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
-
- Aurora
|
8
|
+
- Aurora Nockert
|
9
9
|
- Soumya
|
10
10
|
- Olle Jonsson
|
11
11
|
- William T. Nelson
|
@@ -41,7 +41,7 @@ cert_chain:
|
|
41
41
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
42
42
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
43
43
|
-----END CERTIFICATE-----
|
44
|
-
date:
|
44
|
+
date: 2023-02-04 00:00:00.000000000 Z
|
45
45
|
dependencies:
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: protocol-http
|
@@ -105,14 +105,14 @@ dependencies:
|
|
105
105
|
requirements:
|
106
106
|
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: 0.
|
108
|
+
version: '0.16'
|
109
109
|
type: :development
|
110
110
|
prerelease: false
|
111
111
|
version_requirements: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
113
|
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: 0.
|
115
|
+
version: '0.16'
|
116
116
|
description:
|
117
117
|
email:
|
118
118
|
executables: []
|
@@ -136,11 +136,14 @@ files:
|
|
136
136
|
- lib/protocol/websocket/frame.rb
|
137
137
|
- lib/protocol/websocket/framer.rb
|
138
138
|
- lib/protocol/websocket/headers.rb
|
139
|
+
- lib/protocol/websocket/json_message.rb
|
139
140
|
- lib/protocol/websocket/message.rb
|
140
141
|
- lib/protocol/websocket/ping_frame.rb
|
141
142
|
- lib/protocol/websocket/pong_frame.rb
|
142
143
|
- lib/protocol/websocket/text_frame.rb
|
143
144
|
- lib/protocol/websocket/version.rb
|
145
|
+
- license.md
|
146
|
+
- readme.md
|
144
147
|
homepage: https://github.com/socketry/protocol-websocket
|
145
148
|
licenses:
|
146
149
|
- MIT
|
@@ -160,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
163
|
- !ruby/object:Gem::Version
|
161
164
|
version: '0'
|
162
165
|
requirements: []
|
163
|
-
rubygems_version: 3.
|
166
|
+
rubygems_version: 3.4.1
|
164
167
|
signing_key:
|
165
168
|
specification_version: 4
|
166
169
|
summary: A low level implementation of the WebSocket protocol.
|
metadata.gz.sig
CHANGED
Binary file
|