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 +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/lib/protocol/websocket.rb +2 -1
- data/readme.md +3 -3
- 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: 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/lib/protocol/websocket.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
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
|
-
|
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
|
-
###
|
29
|
+
### Community Guidelines
|
30
30
|
|
31
|
-
This project is
|
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.
|
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
|
@@ -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.
|
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
|