protocol-websocket 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/protocol/websocket/connection.rb +6 -3
- data/lib/protocol/websocket/message.rb +4 -3
- data/lib/protocol/websocket/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: 65d2f2f5247451bba72a1b622fff8caf46fb03d8843531eb107c0a46f4cc5ff1
|
4
|
+
data.tar.gz: 555d8a9a9a9cd09d678d5d04961af2134a06adf1bf32ba42d0ecb608e35528bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd72ffc0701049551abe38408ae500f05dd2d32186cab990f49091e6600357b5c887903fd1e48b23b957b80f8d0deb4d9ddfcd8ac1b2b4c68eb5bbae63cbaf92
|
7
|
+
data.tar.gz: 647ec40540b3f991b79d96b13022f16c1b4fb7960d53b09cbf773a45b5d5726fbbe328a8129ff22e56c9805cd407d2e1bb998f9bc6dc29d1489d66a7b4dfc2b9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -244,16 +244,19 @@ module Protocol
|
|
244
244
|
# Write a message to the connection.
|
245
245
|
# @parameter message [Message] The message to send.
|
246
246
|
def write(message, **options)
|
247
|
+
case message
|
248
|
+
when String
|
247
249
|
# 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.
|
248
|
-
if message.is_a?(String)
|
249
250
|
if message.encoding == Encoding::UTF_8
|
250
251
|
return send_text(message, **options)
|
251
252
|
else
|
252
253
|
return send_binary(message, **options)
|
253
254
|
end
|
255
|
+
when Message
|
256
|
+
message.send(self, **options)
|
257
|
+
else
|
258
|
+
raise ArgumentError, "Unsupported message type: #{message}"
|
254
259
|
end
|
255
|
-
|
256
|
-
message.send(self, **options)
|
257
260
|
end
|
258
261
|
|
259
262
|
# The default implementation for reading a message buffer. This is used by the {#reader} interface.
|
@@ -56,13 +56,14 @@ module Protocol
|
|
56
56
|
def to_h(...)
|
57
57
|
parse(...).to_h
|
58
58
|
end
|
59
|
+
|
60
|
+
def send(connection, **options)
|
61
|
+
connection.send_text(@buffer, **options)
|
62
|
+
end
|
59
63
|
end
|
60
64
|
|
61
65
|
# Represents a text message that can be sent or received over a WebSocket connection.
|
62
66
|
class TextMessage < Message
|
63
|
-
def send(connection, **options)
|
64
|
-
connection.send_text(@buffer, **options)
|
65
|
-
end
|
66
67
|
end
|
67
68
|
|
68
69
|
# Represents a binary message that can be sent or received over a WebSocket connection.
|
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.16.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: 2024-
|
44
|
+
date: 2024-09-03 00:00:00.000000000 Z
|
45
45
|
dependencies:
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: protocol-http
|
metadata.gz.sig
CHANGED
Binary file
|