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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec6ec828408c7579273d456c0a9ce582a794757b5c532e228c45eca4779acee1
4
- data.tar.gz: 5abe7c8dcb8e1e5cd64e62e06cb0f7585ec0fa8646baf4cecaa6945542cf8b33
3
+ metadata.gz: 65d2f2f5247451bba72a1b622fff8caf46fb03d8843531eb107c0a46f4cc5ff1
4
+ data.tar.gz: 555d8a9a9a9cd09d678d5d04961af2134a06adf1bf32ba42d0ecb608e35528bb
5
5
  SHA512:
6
- metadata.gz: e5daf9a48e29e811b255516dd777fafbbdf084c8ed681d81ebe2fc67eead205702186b42231abfa032060afc62d439a2e6c8c90d1696eec58be37c40cf52d2a9
7
- data.tar.gz: 6dc89a62a3179b9e2d397cac57204a5d73897ada519abba42d3f85ec184c6f74c1c2f26d81b2ef5277c0fa4b17c35cf283019f99e9a01537d32fece66c76db2b
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.
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module WebSocket
8
- VERSION = "0.15.0"
8
+ VERSION = "0.16.0"
9
9
  end
10
10
  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.15.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-07-03 00:00:00.000000000 Z
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