protocol-websocket 0.14.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: 03d416a8b81559d07517a00db06f2740b42c1a4e311ab2b1cbc22fcd58041f49
4
- data.tar.gz: af5e7dcf5f2a3d28a7b21a959827462753b5af2f28e9b5f2b41af03c9a09f590
3
+ metadata.gz: 65d2f2f5247451bba72a1b622fff8caf46fb03d8843531eb107c0a46f4cc5ff1
4
+ data.tar.gz: 555d8a9a9a9cd09d678d5d04961af2134a06adf1bf32ba42d0ecb608e35528bb
5
5
  SHA512:
6
- metadata.gz: 0ce48f4ee999d45de148dab68f3b5c7adaca5c35d0d67a2f4cf5a24a80428de545620c9c4eae7c0e96c8950da49b48c34fd98fcde3fb558b0e8111edd971e418
7
- data.tar.gz: 20a33a6c1b1a58cff116973575cf5de64778e9a4a3c5ce74c7de2310c3b4f1ee37e290d6cac705c3e2698cb4452bad9f9de2494104b0b04daa0deab0ab589a4c
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.14.0"
8
+ VERSION = "0.16.0"
9
9
  end
10
10
  end
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
6
  require_relative 'websocket/version'
7
7
  require_relative 'websocket/framer'
8
8
  require_relative 'websocket/connection'
9
+ require_relative 'websocket/message'
data/readme.md CHANGED
@@ -24,8 +24,8 @@ We welcome contributions to this project.
24
24
 
25
25
  ### Developer Certificate of Origin
26
26
 
27
- This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
27
+ In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
28
28
 
29
- ### Contributor Covenant
29
+ ### Community Guidelines
30
30
 
31
- This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
31
+ This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
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.14.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-06-20 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
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  requirements: []
111
- rubygems_version: 3.5.9
111
+ rubygems_version: 3.5.11
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: A low level implementation of the WebSocket protocol.
metadata.gz.sig CHANGED
Binary file