protocol-websocket 0.21.0 → 0.21.2
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 +0 -0
- data/context/index.yaml +2 -0
- data/lib/protocol/websocket/coder/json.rb +6 -15
- data/lib/protocol/websocket/coder.rb +2 -2
- data/lib/protocol/websocket/connection.rb +4 -2
- data/lib/protocol/websocket/error.rb +1 -1
- data/lib/protocol/websocket/extension/compression/inflate.rb +1 -1
- data/lib/protocol/websocket/extensions.rb +2 -4
- data/lib/protocol/websocket/frame.rb +1 -0
- data/lib/protocol/websocket/framer.rb +2 -1
- data/lib/protocol/websocket/headers.rb +1 -1
- data/lib/protocol/websocket/message.rb +1 -1
- data/lib/protocol/websocket/version.rb +1 -1
- data/license.md +1 -1
- data/readme.md +15 -16
- data/releases.md +8 -0
- data.tar.gz.sig +0 -0
- metadata +5 -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: a83c2f568dee5cc427ce444fe4a39ec9da5cff785dce156b20dbf45ff262643d
|
|
4
|
+
data.tar.gz: 42b64b8575ba9d5af47daac91b50a415ed008c5fd683e15035969cec6ea2b849
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d982707a934596bb8578f16b8609b5e24935004f8791ef66c7d12b68df4ae90a726c6cb47f0c6ee80b3806236aa4b6d190589e8569e473b4aa463314977ab52a
|
|
7
|
+
data.tar.gz: 8d81f1ba7dba3b4c2ab910fcdb38c8c268d6f3689001bdee496a646605f0784a7293a143355ee6f13b8ab40b475de190c90734410d5f6308cb8ba6a1e12d5aa5
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/context/index.yaml
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
---
|
|
4
4
|
description: A low level implementation of the WebSocket protocol.
|
|
5
5
|
metadata:
|
|
6
|
+
bug_tracker_uri: https://github.com/socketry/protocol-websocket/issues
|
|
7
|
+
changelog_uri: https://github.com/socketry/protocol-websocket/blob/main/releases.md
|
|
6
8
|
documentation_uri: https://socketry.github.io/protocol-websocket/
|
|
7
9
|
source_code_uri: https://github.com/socketry/protocol-websocket.git
|
|
8
10
|
files:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# Released under the MIT License.
|
|
4
|
-
# Copyright, 2024, by Samuel Williams.
|
|
4
|
+
# Copyright, 2024-2026, by Samuel Williams.
|
|
5
5
|
|
|
6
6
|
require "json"
|
|
7
7
|
|
|
@@ -9,25 +9,16 @@ module Protocol
|
|
|
9
9
|
module WebSocket
|
|
10
10
|
module Coder
|
|
11
11
|
# A JSON coder that uses the standard JSON library.
|
|
12
|
-
|
|
13
|
-
# Initialize a new JSON coder.
|
|
14
|
-
# @parameter options [Hash] Options to pass to the JSON library when parsing or generating.
|
|
15
|
-
def initialize(**options)
|
|
16
|
-
@options = options
|
|
17
|
-
end
|
|
18
|
-
|
|
12
|
+
module JSON
|
|
19
13
|
# Parse a JSON buffer into an object.
|
|
20
|
-
def parse(buffer)
|
|
21
|
-
::JSON.parse(buffer,
|
|
14
|
+
def self.parse(buffer)
|
|
15
|
+
::JSON.parse(buffer, symbolize_names: true)
|
|
22
16
|
end
|
|
23
17
|
|
|
24
18
|
# Generate a JSON buffer from an object.
|
|
25
|
-
def generate(object)
|
|
26
|
-
::JSON.generate(object
|
|
19
|
+
def self.generate(object)
|
|
20
|
+
::JSON.generate(object)
|
|
27
21
|
end
|
|
28
|
-
|
|
29
|
-
# The default JSON coder. This coder will symbolize names.
|
|
30
|
-
DEFAULT = new(symbolize_names: true)
|
|
31
22
|
end
|
|
32
23
|
end
|
|
33
24
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# Released under the MIT License.
|
|
4
|
-
# Copyright, 2024, by Samuel Williams.
|
|
4
|
+
# Copyright, 2024-2026, by Samuel Williams.
|
|
5
5
|
|
|
6
6
|
require_relative "coder/json"
|
|
7
7
|
|
|
@@ -10,7 +10,7 @@ module Protocol
|
|
|
10
10
|
# @namespace
|
|
11
11
|
module Coder
|
|
12
12
|
# The default coder for WebSocket messages.
|
|
13
|
-
DEFAULT = JSON
|
|
13
|
+
DEFAULT = JSON
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# Released under the MIT License.
|
|
4
|
-
# Copyright, 2019-
|
|
5
|
-
# Copyright, 2019, by William T. Nelson.
|
|
4
|
+
# Copyright, 2019-2026, by Samuel Williams.
|
|
5
|
+
# Copyright, 2019-2026, by William T. Nelson.
|
|
6
6
|
# Copyright, 2021, by Aurora Nockert.
|
|
7
7
|
|
|
8
8
|
require_relative "framer"
|
|
@@ -104,6 +104,8 @@ module Protocol
|
|
|
104
104
|
else
|
|
105
105
|
send_close
|
|
106
106
|
end
|
|
107
|
+
rescue
|
|
108
|
+
@state = :closed
|
|
107
109
|
end
|
|
108
110
|
|
|
109
111
|
# Close the connection gracefully. This will send a close frame and wait for the remote end to respond with a close frame. Any data received after the close frame is sent will be ignored. If you want to process this data, use {#close_write} instead, and read the data before calling {#close}.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# Released under the MIT License.
|
|
4
|
-
# Copyright, 2022-
|
|
4
|
+
# Copyright, 2022-2026, by Samuel Williams.
|
|
5
|
+
# Copyright, 2026, by William T. Nelson.
|
|
5
6
|
|
|
6
7
|
require_relative "extension/compression"
|
|
7
8
|
require_relative "headers"
|
|
@@ -135,10 +136,7 @@ module Protocol
|
|
|
135
136
|
# @parameter header [Array(String)] The negotiated extension header tokens.
|
|
136
137
|
# @returns [Array] The accepted extensions as `[klass, options]` pairs.
|
|
137
138
|
def accept(headers)
|
|
138
|
-
extensions = []
|
|
139
|
-
|
|
140
139
|
named = self.named
|
|
141
|
-
response = []
|
|
142
140
|
|
|
143
141
|
# Each response header should map to at least one extension.
|
|
144
142
|
Extensions.parse(headers) do |name, arguments|
|
data/license.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Copyright, 2019-2026, by Samuel Williams.
|
|
4
4
|
Copyright, 2019, by Soumya.
|
|
5
|
-
Copyright, 2019, by William T. Nelson.
|
|
5
|
+
Copyright, 2019-2026, by William T. Nelson.
|
|
6
6
|
Copyright, 2020, by Olle Jonsson.
|
|
7
7
|
Copyright, 2021, by Aurora Nockert.
|
|
8
8
|
Copyright, 2025, by Taleh Zaliyev.
|
data/readme.md
CHANGED
|
@@ -16,6 +16,14 @@ Please see the [project documentation](https://socketry.github.io/protocol-webso
|
|
|
16
16
|
|
|
17
17
|
Please see the [project releases](https://socketry.github.io/protocol-websocket/releases/index) for all releases.
|
|
18
18
|
|
|
19
|
+
### v0.21.2
|
|
20
|
+
|
|
21
|
+
- Fix JSON 3 compatibility by applying `symbolize_names` only when parsing incoming messages. `Coder::JSON` is now a module with fixed parsing and generation behavior; pass a different coder to customize serialization.
|
|
22
|
+
|
|
23
|
+
### v0.21.1
|
|
24
|
+
|
|
25
|
+
- If `Connection#close_write` fails, the connection will now be fully closed to prevent hanging connections.
|
|
26
|
+
|
|
19
27
|
### v0.21.0
|
|
20
28
|
|
|
21
29
|
- All frame reading and writing logic has been consolidated into `Framer` to improve performance.
|
|
@@ -49,39 +57,30 @@ Please see the [project releases](https://socketry.github.io/protocol-websocket/
|
|
|
49
57
|
|
|
50
58
|
- Introduce `#close_write` and `#shutdown` methods on `Connection` for more precise connection lifecycle control.
|
|
51
59
|
|
|
52
|
-
### v0.16.0
|
|
53
|
-
|
|
54
|
-
- Move `#send` logic into `Message` for better encapsulation.
|
|
55
|
-
- Improve error handling when a `nil` message is passed.
|
|
56
|
-
|
|
57
|
-
### v0.15.0
|
|
58
|
-
|
|
59
|
-
- Require `Message` class by default.
|
|
60
|
-
|
|
61
60
|
## Contributing
|
|
62
61
|
|
|
63
62
|
We welcome contributions to this project.
|
|
64
63
|
|
|
65
|
-
1. Fork
|
|
64
|
+
1. Fork the repository.
|
|
66
65
|
2. Create your feature branch (`git checkout -b my-new-feature`).
|
|
67
|
-
3. Commit your changes (`git commit -am 'Add some feature'`).
|
|
66
|
+
3. Commit your changes (`git commit -am 'Add some feature.'`).
|
|
68
67
|
4. Push to the branch (`git push origin my-new-feature`).
|
|
69
|
-
5. Create new
|
|
68
|
+
5. Create a new pull request.
|
|
70
69
|
|
|
71
70
|
### Running Tests
|
|
72
71
|
|
|
73
72
|
To run the test suite:
|
|
74
73
|
|
|
75
|
-
```
|
|
76
|
-
bundle exec sus
|
|
74
|
+
``` bash
|
|
75
|
+
$ bundle exec sus
|
|
77
76
|
```
|
|
78
77
|
|
|
79
78
|
### Making Releases
|
|
80
79
|
|
|
81
80
|
To make a new release:
|
|
82
81
|
|
|
83
|
-
```
|
|
84
|
-
bundle exec bake gem:release:patch # or minor or major
|
|
82
|
+
``` bash
|
|
83
|
+
$ bundle exec bake gem:release:patch # or minor or major
|
|
85
84
|
```
|
|
86
85
|
|
|
87
86
|
### Developer Certificate of Origin
|
data/releases.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Releases
|
|
2
2
|
|
|
3
|
+
## v0.21.2
|
|
4
|
+
|
|
5
|
+
- Fix JSON 3 compatibility by applying `symbolize_names` only when parsing incoming messages. `Coder::JSON` is now a module with fixed parsing and generation behavior; pass a different coder to customize serialization.
|
|
6
|
+
|
|
7
|
+
## v0.21.1
|
|
8
|
+
|
|
9
|
+
- If `Connection#close_write` fails, the connection will now be fully closed to prevent hanging connections.
|
|
10
|
+
|
|
3
11
|
## v0.21.0
|
|
4
12
|
|
|
5
13
|
- All frame reading and writing logic has been consolidated into `Framer` to improve performance.
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: protocol-websocket
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.21.
|
|
4
|
+
version: 0.21.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
8
|
+
- William T. Nelson
|
|
8
9
|
- Aurora Nockert
|
|
9
10
|
- Soumya
|
|
10
11
|
- Olle Jonsson
|
|
11
12
|
- Taleh Zaliyev
|
|
12
|
-
- William T. Nelson
|
|
13
13
|
bindir: bin
|
|
14
14
|
cert_chain:
|
|
15
15
|
- |
|
|
@@ -92,6 +92,8 @@ homepage: https://github.com/socketry/protocol-websocket
|
|
|
92
92
|
licenses:
|
|
93
93
|
- MIT
|
|
94
94
|
metadata:
|
|
95
|
+
bug_tracker_uri: https://github.com/socketry/protocol-websocket/issues
|
|
96
|
+
changelog_uri: https://github.com/socketry/protocol-websocket/blob/main/releases.md
|
|
95
97
|
documentation_uri: https://socketry.github.io/protocol-websocket/
|
|
96
98
|
source_code_uri: https://github.com/socketry/protocol-websocket.git
|
|
97
99
|
rdoc_options: []
|
|
@@ -108,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
108
110
|
- !ruby/object:Gem::Version
|
|
109
111
|
version: '0'
|
|
110
112
|
requirements: []
|
|
111
|
-
rubygems_version: 4.0.
|
|
113
|
+
rubygems_version: 4.0.10
|
|
112
114
|
specification_version: 4
|
|
113
115
|
summary: A low level implementation of the WebSocket protocol.
|
|
114
116
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|