e621stream 0.0.0

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.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +35 -0
  4. data/lib/e621stream/client/options.rb +20 -0
  5. data/lib/e621stream/client.rb +211 -0
  6. data/lib/e621stream/close_codes.rb +23 -0
  7. data/lib/e621stream/event.rb +24 -0
  8. data/lib/e621stream/events.rb +29 -0
  9. data/lib/e621stream/stream_error.rb +18 -0
  10. data/lib/e621stream/version.rb +5 -0
  11. data/lib/e621stream.rb +18 -0
  12. data/sorbet/config +6 -0
  13. data/sorbet/rbi/annotations/.gitattributes +1 -0
  14. data/sorbet/rbi/annotations/minitest.rbi +120 -0
  15. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  16. data/sorbet/rbi/gems/.gitattributes +1 -0
  17. data/sorbet/rbi/gems/ast@2.4.3.rbi +550 -0
  18. data/sorbet/rbi/gems/async-http@0.105.0.rbi +1649 -0
  19. data/sorbet/rbi/gems/async-pool@0.12.0.rbi +219 -0
  20. data/sorbet/rbi/gems/async-websocket@0.30.2.rbi +271 -0
  21. data/sorbet/rbi/gems/async@2.46.0.rbi +2193 -0
  22. data/sorbet/rbi/gems/benchmark@0.5.0.rbi +495 -0
  23. data/sorbet/rbi/gems/console@1.38.0.rbi +1552 -0
  24. data/sorbet/rbi/gems/erb@6.0.7.rbi +1581 -0
  25. data/sorbet/rbi/gems/erubi@1.13.1.rbi +153 -0
  26. data/sorbet/rbi/gems/fiber-annotation@0.2.0.rbi +62 -0
  27. data/sorbet/rbi/gems/fiber-local@1.1.0.rbi +36 -0
  28. data/sorbet/rbi/gems/fiber-storage@1.0.1.rbi +43 -0
  29. data/sorbet/rbi/gems/io-console@0.9.5.rbi +9 -0
  30. data/sorbet/rbi/gems/io-endpoint@0.19.0.rbi +1079 -0
  31. data/sorbet/rbi/gems/io-event@1.22.3.rbi +971 -0
  32. data/sorbet/rbi/gems/io-stream@0.14.0.rbi +805 -0
  33. data/sorbet/rbi/gems/json@3.1.0.rbi +1929 -0
  34. data/sorbet/rbi/gems/language_server-protocol@3.17.0.6.rbi +9 -0
  35. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +189 -0
  36. data/sorbet/rbi/gems/logger@1.7.0.rbi +896 -0
  37. data/sorbet/rbi/gems/minitest@5.27.0.rbi +1499 -0
  38. data/sorbet/rbi/gems/netrc@0.11.0.rbi +147 -0
  39. data/sorbet/rbi/gems/openssl@4.0.2.rbi +4366 -0
  40. data/sorbet/rbi/gems/parallel@2.3.0.rbi +332 -0
  41. data/sorbet/rbi/gems/parser@3.3.13.0.rbi +5146 -0
  42. data/sorbet/rbi/gems/pp@0.6.4.rbi +373 -0
  43. data/sorbet/rbi/gems/prettyprint@0.2.1.rbi +476 -0
  44. data/sorbet/rbi/gems/prism@1.9.0.rbi +42213 -0
  45. data/sorbet/rbi/gems/protocol-hpack@1.5.1.rbi +418 -0
  46. data/sorbet/rbi/gems/protocol-http1@0.41.1.rbi +894 -0
  47. data/sorbet/rbi/gems/protocol-http2@0.29.2.rbi +2277 -0
  48. data/sorbet/rbi/gems/protocol-http@0.72.1.rbi +3801 -0
  49. data/sorbet/rbi/gems/protocol-rack@0.23.0.rbi +9 -0
  50. data/sorbet/rbi/gems/protocol-url@0.19.0.rbi +9 -0
  51. data/sorbet/rbi/gems/protocol-websocket@0.21.3.rbi +1087 -0
  52. data/sorbet/rbi/gems/racc@1.8.1.rbi +169 -0
  53. data/sorbet/rbi/gems/rack@3.2.8.rbi +9 -0
  54. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +362 -0
  55. data/sorbet/rbi/gems/rake@13.4.2.rbi +3127 -0
  56. data/sorbet/rbi/gems/rbi@0.5.0.rbi +5875 -0
  57. data/sorbet/rbi/gems/rbs@4.2.0.rbi +7133 -0
  58. data/sorbet/rbi/gems/rdoc@8.1.0.rbi +9 -0
  59. data/sorbet/rbi/gems/regexp_parser@2.13.1.rbi +3500 -0
  60. data/sorbet/rbi/gems/reline@0.7.0.rbi +2449 -0
  61. data/sorbet/rbi/gems/require-hooks@0.5.1.rbi +152 -0
  62. data/sorbet/rbi/gems/rexml@3.4.4.rbi +4905 -0
  63. data/sorbet/rbi/gems/rubocop-ast@1.51.0.rbi +7230 -0
  64. data/sorbet/rbi/gems/rubocop-rake@0.7.1.rbi +314 -0
  65. data/sorbet/rbi/gems/rubocop@1.92.2.rbi +69094 -0
  66. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +988 -0
  67. data/sorbet/rbi/gems/rubydex@0.4.4.rbi +1620 -0
  68. data/sorbet/rbi/gems/spoom@1.8.13.rbi +7380 -0
  69. data/sorbet/rbi/gems/tapioca@0.20.0.rbi +3752 -0
  70. data/sorbet/rbi/gems/thor@1.5.0.rbi +3870 -0
  71. data/sorbet/rbi/gems/tsort@0.2.0.rbi +389 -0
  72. data/sorbet/rbi/gems/unicode-display_width@3.3.0.rbi +130 -0
  73. data/sorbet/rbi/gems/unicode-emoji@4.3.0.rbi +254 -0
  74. data/sorbet/rbi/gems/zeitwerk@2.8.3.rbi +1178 -0
  75. data/sorbet/tapioca/config.yml +13 -0
  76. data/sorbet/tapioca/require.rb +4 -0
  77. metadata +175 -0
@@ -0,0 +1,1087 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `protocol-websocket` gem.
5
+ # Please instead update this file by running `bin/tapioca gem protocol-websocket`.
6
+
7
+
8
+ # @namespace
9
+ #
10
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/headers.rb:9
11
+ module Protocol; end
12
+
13
+ # @namespace
14
+ #
15
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/headers.rb:10
16
+ module Protocol::WebSocket; end
17
+
18
+ # Represents a binary frame that is sent or received by a WebSocket connection.
19
+ #
20
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/binary_frame.rb:13
21
+ class Protocol::WebSocket::BinaryFrame < ::Protocol::WebSocket::Frame
22
+ # Apply this frame to the specified connection.
23
+ #
24
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/binary_frame.rb:28
25
+ def apply(connection); end
26
+
27
+ # @returns [Boolean] if the frame contains data.
28
+ #
29
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/binary_frame.rb:17
30
+ def data?; end
31
+
32
+ # Decode the binary buffer into a suitable binary message.
33
+ # @parameter buffer [String] The binary data to unpack.
34
+ #
35
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/binary_frame.rb:23
36
+ def read_message(buffer); end
37
+ end
38
+
39
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/binary_frame.rb:14
40
+ Protocol::WebSocket::BinaryFrame::OPCODE = T.let(T.unsafe(nil), Integer)
41
+
42
+ # Represents a binary message that can be sent or received over a WebSocket connection.
43
+ #
44
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/message.rb:72
45
+ class Protocol::WebSocket::BinaryMessage < ::Protocol::WebSocket::Message
46
+ # Send this message as a binary frame over the given connection.
47
+ # @parameter connection [Connection] The WebSocket connection to send through.
48
+ #
49
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/message.rb:75
50
+ def send(connection, **options); end
51
+ end
52
+
53
+ # Represents a close frame that is sent or received by a WebSocket connection.
54
+ #
55
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/close_frame.rb:12
56
+ class Protocol::WebSocket::CloseFrame < ::Protocol::WebSocket::Frame
57
+ # Apply this frame to the specified connection.
58
+ #
59
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/close_frame.rb:71
60
+ def apply(connection); end
61
+
62
+ # Pack a close code and reason into the frame data.
63
+ # If code is missing, reason is ignored.
64
+ # @parameter code [Integer | Nil] The close code.
65
+ # @parameter reason [String | Nil] The close reason.
66
+ #
67
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/close_frame.rb:50
68
+ def pack(code = T.unsafe(nil), reason = T.unsafe(nil)); end
69
+
70
+ # Generate a suitable reply.
71
+ # @returns [CloseFrame]
72
+ #
73
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/close_frame.rb:64
74
+ def reply(code = T.unsafe(nil), reason = T.unsafe(nil)); end
75
+
76
+ # Unpack the frame data into a close code and reason.
77
+ # @returns [Tuple(Integer, String)] The close code and reason.
78
+ #
79
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/close_frame.rb:18
80
+ def unpack; end
81
+ end
82
+
83
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/close_frame.rb:14
84
+ Protocol::WebSocket::CloseFrame::FORMAT = T.let(T.unsafe(nil), String)
85
+
86
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/close_frame.rb:13
87
+ Protocol::WebSocket::CloseFrame::OPCODE = T.let(T.unsafe(nil), Integer)
88
+
89
+ # The connection was closed, maybe unexpectedly.
90
+ #
91
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/error.rb:58
92
+ class Protocol::WebSocket::ClosedError < ::Protocol::WebSocket::ProtocolError; end
93
+
94
+ # @namespace
95
+ #
96
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/coder/json.rb:10
97
+ module Protocol::WebSocket::Coder; end
98
+
99
+ # The default coder for WebSocket messages.
100
+ #
101
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/coder.rb:13
102
+ Protocol::WebSocket::Coder::DEFAULT = Protocol::WebSocket::Coder::JSON
103
+
104
+ # A JSON coder that uses the standard JSON library.
105
+ #
106
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/coder/json.rb:12
107
+ module Protocol::WebSocket::Coder::JSON
108
+ class << self
109
+ # Generate a JSON buffer from an object.
110
+ #
111
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/coder/json.rb:19
112
+ def generate(object); end
113
+
114
+ # Parse a JSON buffer into an object.
115
+ #
116
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/coder/json.rb:14
117
+ def parse(buffer); end
118
+ end
119
+ end
120
+
121
+ # Wraps a framer and implements for implementing connection specific interactions like reading and writing text.
122
+ #
123
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:13
124
+ class Protocol::WebSocket::Connection
125
+ # @parameter mask [String] 4-byte mask to be used for frames generated by this connection.
126
+ #
127
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:15
128
+ def initialize(framer, mask: T.unsafe(nil), **options); end
129
+
130
+ # Immediately transition the connection to the closed state *and* close the underlying connection. Any data not yet read will be lost.
131
+ #
132
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:92
133
+ def close(*, **, &); end
134
+
135
+ # If not already closed, transition the connection to the closed state and send a close frame.
136
+ # Will try to send a close frame with the specified code and reason, but will ignore any errors that occur while sending.
137
+ #
138
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:72
139
+ def close!(*, **, &); end
140
+
141
+ # Close the connection gracefully, sending a close frame with the specified error code and reason. If an error occurs while sending the close frame, the connection will be closed immediately. You may continue to read data from the connection after calling this method, but you should not write any more data.
142
+ #
143
+ # @parameter error [Error | Nil] The error that occurred, if any.
144
+ #
145
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:101
146
+ def close_write(error = T.unsafe(nil)); end
147
+
148
+ # @returns [Boolean] if the connection is in the closed state.
149
+ #
150
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:87
151
+ def closed?; end
152
+
153
+ # Flush the underlying framer to ensure all buffered data is written to the connection.
154
+ #
155
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:59
156
+ def flush; end
157
+
158
+ # @attribute [Framer] The framer which is used for reading and writing frames.
159
+ #
160
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:29
161
+ def framer; end
162
+
163
+ # @attribute [Array(Frame)] Buffered frames which form part of a complete message.
164
+ #
165
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:38
166
+ def frames; end
167
+
168
+ # @attribute [Array(Frame)] Buffered frames which form part of a complete message.
169
+ #
170
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:38
171
+ def frames=(_arg0); end
172
+
173
+ # @attribute [String | Boolean | Nil] The optional mask which is used when generating frames.
174
+ #
175
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:32
176
+ def mask; end
177
+
178
+ # Transition the connection to the open state (the default for new connections).
179
+ #
180
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:64
181
+ def open!; end
182
+
183
+ # Pack a binary frame with the specified buffer. This is used by the {#writer} interface.
184
+ # @parameter buffer [String] The binary data to pack into the frame.
185
+ # @returns [BinaryFrame] The packed frame.
186
+ #
187
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:242
188
+ def pack_binary_frame(buffer, **options); end
189
+
190
+ # Pack a text frame with the specified buffer. This is used by the {#writer} interface.
191
+ # @parameter buffer [String] The text to pack into the frame.
192
+ # @returns [TextFrame] The packed frame.
193
+ #
194
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:226
195
+ def pack_text_frame(buffer, **options); end
196
+
197
+ # Read a message from the connection. If an error occurs while reading the message, the connection will be closed.
198
+ #
199
+ # If the message is fragmented, this method will buffer the frames until a complete message is received.
200
+ #
201
+ # @returns message [Message] The received message.
202
+ #
203
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:298
204
+ def read(**options); end
205
+
206
+ # Read a frame from the framer, and apply it to the connection.
207
+ #
208
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:122
209
+ def read_frame; end
210
+
211
+ # @attribute [Object] The reader which is used to unpack frames into messages.
212
+ #
213
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:41
214
+ def reader; end
215
+
216
+ # @attribute [Object] The reader which is used to unpack frames into messages.
217
+ #
218
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:41
219
+ def reader=(_arg0); end
220
+
221
+ # Receive a binary frame for the connection.
222
+ #
223
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:162
224
+ def receive_binary(frame); end
225
+
226
+ # Receive a close frame from the connection.
227
+ #
228
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:180
229
+ def receive_close(frame); end
230
+
231
+ # Receive a continuation frame for the connection.
232
+ #
233
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:171
234
+ def receive_continuation(frame); end
235
+
236
+ # Receive a frame that is not a control frame. By default, this method raises a {ProtocolError}.
237
+ #
238
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:219
239
+ def receive_frame(frame); end
240
+
241
+ # Receive a ping frame from the connection.
242
+ #
243
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:205
244
+ def receive_ping(frame); end
245
+
246
+ # Receive a pong frame from the connection. By default, this method does nothing.
247
+ #
248
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:214
249
+ def receive_pong(frame); end
250
+
251
+ # Receive a text frame from the connection.
252
+ #
253
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:153
254
+ def receive_text(frame); end
255
+
256
+ # Reserve a bit in the reserved flags for an extension.
257
+ # @parameter bit [Integer] The bit to reserve, see {Frame::RESERVED} for more details.
258
+ #
259
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:48
260
+ def reserve!(bit); end
261
+
262
+ # @attribute [Integer] The allowed reserved bits.
263
+ #
264
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:35
265
+ def reserved; end
266
+
267
+ # Send a binary frame with the specified buffer.
268
+ # @parameter buffer [String] The binary data to send.
269
+ #
270
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:251
271
+ def send_binary(buffer, **options); end
272
+
273
+ # Send a control frame with data containing a specified control sequence to begin the closing handshake. Does not close the connection, until the remote end responds with a close frame.
274
+ # @parameter code [Integer] The close code to send.
275
+ # @parameter reason [String] The reason for closing the connection.
276
+ #
277
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:258
278
+ def send_close(code = T.unsafe(nil), reason = T.unsafe(nil)); end
279
+
280
+ # Send a ping frame with the specified data.
281
+ # @parameter data [String] The data to send in the ping frame.
282
+ #
283
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:193
284
+ def send_ping(data = T.unsafe(nil)); end
285
+
286
+ # Send a text frame with the specified buffer.
287
+ # @parameter buffer [String] The text to send.
288
+ #
289
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:235
290
+ def send_text(buffer, **options); end
291
+
292
+ # 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}.
293
+ #
294
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:112
295
+ def shutdown; end
296
+
297
+ # The default implementation for reading a message buffer. This is used by the {#reader} interface.
298
+ #
299
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:285
300
+ def unpack_frames(frames); end
301
+
302
+ # Write a message to the connection.
303
+ # @parameter message [Message] The message to send.
304
+ #
305
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:268
306
+ def write(message, **options); end
307
+
308
+ # Write a frame to the framer.
309
+ # Note: This does not immediately write the frame to the connection, you must call {#flush} to ensure the frame is written.
310
+ #
311
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:146
312
+ def write_frame(frame); end
313
+
314
+ # @attribute [Object] The writer which is used to pack messages into frames.
315
+ #
316
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:44
317
+ def writer; end
318
+
319
+ # @attribute [Object] The writer which is used to pack messages into frames.
320
+ #
321
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/connection.rb:44
322
+ def writer=(_arg0); end
323
+ end
324
+
325
+ # Represents a continuation frame that is sent or received by a WebSocket connection when a message is split into multiple frames.
326
+ #
327
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/continuation_frame.rb:11
328
+ class Protocol::WebSocket::ContinuationFrame < ::Protocol::WebSocket::Frame
329
+ # Apply this frame to the specified connection.
330
+ #
331
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/continuation_frame.rb:15
332
+ def apply(connection); end
333
+ end
334
+
335
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/continuation_frame.rb:12
336
+ Protocol::WebSocket::ContinuationFrame::OPCODE = T.let(T.unsafe(nil), Integer)
337
+
338
+ # Represents an error that occurred during the WebSocket protocol negotiation or communication.
339
+ # Status codes as defined by <https://tools.ietf.org/html/rfc6455#section-7.4.1>.
340
+ #
341
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/error.rb:12
342
+ class Protocol::WebSocket::Error < ::Protocol::HTTP::Error; end
343
+
344
+ # Indicates that an endpoint is "going away", such as a server going down or a browser having navigated away from a page.
345
+ #
346
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/error.rb:17
347
+ Protocol::WebSocket::Error::GOING_AWAY = T.let(T.unsafe(nil), Integer)
348
+
349
+ # Indicates that a server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.
350
+ #
351
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/error.rb:39
352
+ Protocol::WebSocket::Error::INTERNAL_ERROR = T.let(T.unsafe(nil), Integer)
353
+
354
+ # Indicates that an endpoint is terminating the connection because it has received a type of data it cannot accept. (e.g., an endpoint that understands only text data MAY send this if it receives a binary message).
355
+ #
356
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/error.rb:23
357
+ Protocol::WebSocket::Error::INVALID_DATA = T.let(T.unsafe(nil), Integer)
358
+
359
+ # Indicates that an endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the message (e.g., non-UTF-8 data within a text message).
360
+ #
361
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/error.rb:27
362
+ Protocol::WebSocket::Error::INVALID_PAYLOAD = T.let(T.unsafe(nil), Integer)
363
+
364
+ # Indicates that an endpoint is terminating the connection because it has received a message that is too big for it to process.
365
+ #
366
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/error.rb:33
367
+ Protocol::WebSocket::Error::MESSAGE_TOO_LARGE = T.let(T.unsafe(nil), Integer)
368
+
369
+ # Indicates that an endpoint (client) is terminating the connection because it has expected the server to negotiate one or more extension, but the server didn't return them in the response message of the WebSocket handshake. The list of extensions that are needed should appear in the /reason/ part of the Close frame. Note that this status code is not used by the server, because it can fail the WebSocket handshake instead.
370
+ #
371
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/error.rb:36
372
+ Protocol::WebSocket::Error::MISSING_EXTENSION = T.let(T.unsafe(nil), Integer)
373
+
374
+ # Indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled.
375
+ #
376
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/error.rb:14
377
+ Protocol::WebSocket::Error::NO_ERROR = T.let(T.unsafe(nil), Integer)
378
+
379
+ # Indicates that an endpoint is terminating the connection because it has received a message that violates its policy. This is a generic status code that can be returned when there is no other more suitable status code (e.g., 1003 or 1009) or if there is a need to hide specific details about the policy.
380
+ #
381
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/error.rb:30
382
+ Protocol::WebSocket::Error::POLICY_VIOLATION = T.let(T.unsafe(nil), Integer)
383
+
384
+ # Indicates that an endpoint is terminating the connection due to a protocol error.
385
+ #
386
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/error.rb:20
387
+ Protocol::WebSocket::Error::PROTOCOL_ERROR = T.let(T.unsafe(nil), Integer)
388
+
389
+ # @namespace
390
+ #
391
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/constants.rb:10
392
+ module Protocol::WebSocket::Extension; end
393
+
394
+ # Provides support for the permessage-deflate extension.
395
+ #
396
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/constants.rb:11
397
+ module Protocol::WebSocket::Extension::Compression
398
+ class << self
399
+ # Accept on the client, the negotiated server response.
400
+ # @parameter options [Hash] a hash of options which are accepted by the client.
401
+ # @parameter arguments [Array(String)] a list of compression parameters as accepted/negotiated by the server.
402
+ #
403
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression.rb:95
404
+ def accept(arguments, **options); end
405
+
406
+ # @parameter options [Hash] a hash of options which are accepted by the client.
407
+ #
408
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression.rb:115
409
+ def client(connection, **options); end
410
+
411
+ # Negotiate on the server a response to client based on the incoming client offer.
412
+ # @parameter options [Hash] a hash of options which are accepted by the server.
413
+ # @returns [Array(String)] a list of compression parameters suitable to send back to the client.
414
+ #
415
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression.rb:54
416
+ def negotiate(arguments, **options); end
417
+
418
+ # Client offer to server, construct a list of requested compression parameters suitable for the `Sec-WebSocket-Extensions` header.
419
+ # @returns [Array(String)] a list of compression parameters suitable to send to the server.
420
+ #
421
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression.rb:18
422
+ def offer(client_max_window_bits: T.unsafe(nil), server_max_window_bits: T.unsafe(nil), client_no_context_takeover: T.unsafe(nil), server_no_context_takeover: T.unsafe(nil)); end
423
+
424
+ # @parameter options [Hash] a hash of options which are accepted by the server.
425
+ #
426
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression.rb:85
427
+ def server(connection, **options); end
428
+ end
429
+ end
430
+
431
+ # Compresses outgoing WebSocket frames using the DEFLATE algorithm.
432
+ #
433
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/deflate.rb:13
434
+ class Protocol::WebSocket::Extension::Compression::Deflate
435
+ # Initialize a new deflate compressor.
436
+ # @parameter parent [Object] The parent framer to wrap.
437
+ # @parameter level [Integer] The compression level. Defaults to `Zlib::DEFAULT_COMPRESSION`.
438
+ # @parameter memory_level [Integer] The memory level for compression. Defaults to `Zlib::DEF_MEM_LEVEL`.
439
+ # @parameter strategy [Integer] The compression strategy. Defaults to `Zlib::DEFAULT_STRATEGY`.
440
+ # @parameter window_bits [Integer] The window size in bits for the DEFLATE algorithm.
441
+ # @parameter context_takeover [Boolean] Whether to reuse the compression context across messages.
442
+ #
443
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/deflate.rb:39
444
+ def initialize(parent, level: T.unsafe(nil), memory_level: T.unsafe(nil), strategy: T.unsafe(nil), window_bits: T.unsafe(nil), context_takeover: T.unsafe(nil), **options); end
445
+
446
+ # @attribute [Boolean] Whether the compression context is reused across messages.
447
+ #
448
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/deflate.rb:65
449
+ def context_takeover; end
450
+
451
+ # Pack a binary frame, optionally compressing the buffer.
452
+ # @parameter buffer [String] The binary payload to pack.
453
+ # @parameter compress [Boolean] Whether to compress the buffer. Defaults to `false`.
454
+ # @returns [Frame] The packed (and optionally compressed) binary frame.
455
+ #
456
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/deflate.rb:89
457
+ def pack_binary_frame(buffer, compress: T.unsafe(nil), **options); end
458
+
459
+ # Pack a text frame, optionally compressing the buffer.
460
+ # @parameter buffer [String] The text payload to pack.
461
+ # @parameter compress [Boolean] Whether to compress the buffer. Defaults to `true`.
462
+ # @returns [Frame] The packed (and optionally compressed) text frame.
463
+ #
464
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/deflate.rb:71
465
+ def pack_text_frame(buffer, compress: T.unsafe(nil), **options); end
466
+
467
+ # @returns [String] A string representation including window bits and context takeover settings.
468
+ #
469
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/deflate.rb:58
470
+ def to_s; end
471
+
472
+ # @attribute [Integer] The window size in bits used for compression.
473
+ #
474
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/deflate.rb:63
475
+ def window_bits; end
476
+
477
+ private
478
+
479
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/deflate.rb:105
480
+ def deflate(buffer); end
481
+
482
+ class << self
483
+ # Client writing to server.
484
+ #
485
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/deflate.rb:15
486
+ def client(parent, client_max_window_bits: T.unsafe(nil), client_no_context_takeover: T.unsafe(nil), **options); end
487
+
488
+ # Server writing to client.
489
+ #
490
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/deflate.rb:24
491
+ def server(parent, server_max_window_bits: T.unsafe(nil), server_no_context_takeover: T.unsafe(nil), **options); end
492
+ end
493
+ end
494
+
495
+ # Decompresses incoming WebSocket frames using the DEFLATE algorithm.
496
+ #
497
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/inflate.rb:13
498
+ class Protocol::WebSocket::Extension::Compression::Inflate
499
+ # Initialize a new inflate decompressor.
500
+ # @parameter parent [Object] The parent framer to wrap.
501
+ # @parameter context_takeover [Boolean] Whether to reuse the decompression context across messages.
502
+ # @parameter window_bits [Integer] The window size in bits for the DEFLATE algorithm.
503
+ #
504
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/inflate.rb:36
505
+ def initialize(parent, context_takeover: T.unsafe(nil), window_bits: T.unsafe(nil)); end
506
+
507
+ # @attribute [Boolean] Whether the decompression context is reused across messages.
508
+ #
509
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/inflate.rb:58
510
+ def context_takeover; end
511
+
512
+ # @returns [String] A string representation including window bits and context takeover settings.
513
+ #
514
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/inflate.rb:51
515
+ def to_s; end
516
+
517
+ # Unpack and decompress frames into a buffer.
518
+ # @parameter frames [Array(Frame)] The frames to unpack.
519
+ # @returns [String] The decompressed payload buffer.
520
+ #
521
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/inflate.rb:63
522
+ def unpack_frames(frames, **options); end
523
+
524
+ # @attribute [Integer] The window size in bits used for decompression.
525
+ #
526
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/inflate.rb:56
527
+ def window_bits; end
528
+
529
+ private
530
+
531
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/inflate.rb:78
532
+ def inflate(buffer); end
533
+
534
+ class << self
535
+ # Client reading from server.
536
+ #
537
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/inflate.rb:15
538
+ def client(parent, server_max_window_bits: T.unsafe(nil), server_no_context_takeover: T.unsafe(nil), **options); end
539
+
540
+ # Server reading from client.
541
+ #
542
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/inflate.rb:23
543
+ def server(parent, client_max_window_bits: T.unsafe(nil), client_no_context_takeover: T.unsafe(nil), **options); end
544
+ end
545
+ end
546
+
547
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/inflate.rb:30
548
+ Protocol::WebSocket::Extension::Compression::Inflate::TRAILER = T.let(T.unsafe(nil), String)
549
+
550
+ # Zlib is not capable of handling < 9 window bits.
551
+ #
552
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/constants.rb:15
553
+ Protocol::WebSocket::Extension::Compression::MINIMUM_WINDOW_BITS = T.let(T.unsafe(nil), Integer)
554
+
555
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extension/compression/constants.rb:12
556
+ Protocol::WebSocket::Extension::Compression::NAME = T.let(T.unsafe(nil), String)
557
+
558
+ # Manages WebSocket extensions negotiated during the handshake.
559
+ #
560
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:13
561
+ module Protocol::WebSocket::Extensions
562
+ class << self
563
+ # Parse a list of extension header values into name and argument pairs.
564
+ # @parameter headers [Array(String)] The raw extension header values.
565
+ # @yields {|name, arguments| ...} Each parsed extension.
566
+ # @parameter name [String] The name of the extension.
567
+ # @parameter arguments [Array] The key-value argument pairs.
568
+ #
569
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:19
570
+ def parse(headers); end
571
+ end
572
+ end
573
+
574
+ # Manages extensions on the client side, offering and accepting server responses.
575
+ #
576
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:34
577
+ class Protocol::WebSocket::Extensions::Client
578
+ # Initialize a new client extension manager.
579
+ # @parameter extensions [Array] The list of extensions to offer, each as `[klass, options]`.
580
+ #
581
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:45
582
+ def initialize(extensions = T.unsafe(nil)); end
583
+
584
+ # Accept server extension responses and record the negotiated extensions.
585
+ # @parameter headers [Array(String)] The `Sec-WebSocket-Extensions` response header values.
586
+ # @returns [Array] The accepted extensions as `[klass, options]` pairs.
587
+ #
588
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:77
589
+ def accept(headers); end
590
+
591
+ # @attribute [Array] The extensions accepted after negotiation.
592
+ #
593
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:53
594
+ def accepted; end
595
+
596
+ # Apply all accepted extensions to the given connection as a client.
597
+ # @parameter connection [Connection] The WebSocket connection to configure.
598
+ #
599
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:96
600
+ def apply(connection); end
601
+
602
+ # @attribute [Array] The list of extensions to offer.
603
+ #
604
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:51
605
+ def extensions; end
606
+
607
+ # Build a lookup table of extensions keyed by their name.
608
+ # @returns [Hash] A hash mapping extension names to their `[klass, options]` pairs.
609
+ #
610
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:57
611
+ def named; end
612
+
613
+ # Yield extension offer headers for each registered extension.
614
+ # @yields {|header| ...} Each offer header string.
615
+ # @parameter header [Array(String)] The extension offer header tokens.
616
+ #
617
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:66
618
+ def offer; end
619
+
620
+ class << self
621
+ # Create a default client with permessage-deflate compression enabled.
622
+ # @returns [Client] A new client with the default compression extension.
623
+ #
624
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:37
625
+ def default; end
626
+ end
627
+ end
628
+
629
+ # Manages extensions on the server side, negotiating client offers and applying the agreed extensions.
630
+ #
631
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:104
632
+ class Protocol::WebSocket::Extensions::Server
633
+ # Initialize a new server extension manager.
634
+ # @parameter extensions [Array] The list of supported extensions, each as `[klass, options]`.
635
+ #
636
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:115
637
+ def initialize(extensions); end
638
+
639
+ # Negotiate client extension offers and yield accepted response headers.
640
+ # @parameter headers [Array(String)] The `Sec-WebSocket-Extensions` request header values.
641
+ # @yields {|header| ...} Each accepted extension header to include in the response.
642
+ # @parameter header [Array(String)] The negotiated extension header tokens.
643
+ # @returns [Array] The accepted extensions as `[klass, options]` pairs.
644
+ #
645
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:138
646
+ def accept(headers); end
647
+
648
+ # @attribute [Array] The extensions accepted after negotiation.
649
+ #
650
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:123
651
+ def accepted; end
652
+
653
+ # Apply all accepted extensions to the given connection as a server.
654
+ # @parameter connection [Connection] The WebSocket connection to configure.
655
+ #
656
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:164
657
+ def apply(connection); end
658
+
659
+ # @attribute [Array] The list of supported extensions.
660
+ #
661
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:121
662
+ def extensions; end
663
+
664
+ # Build a lookup table of extensions keyed by their name.
665
+ # @returns [Hash] A hash mapping extension names to their `[klass, options]` pairs.
666
+ #
667
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:127
668
+ def named; end
669
+
670
+ class << self
671
+ # Create a default server with permessage-deflate compression enabled.
672
+ # @returns [Server] A new server with the default compression extension.
673
+ #
674
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/extensions.rb:107
675
+ def default; end
676
+ end
677
+ end
678
+
679
+ # HTTP/2 frame type mapping as defined by the spec.
680
+ #
681
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/framer.rb:19
682
+ Protocol::WebSocket::FRAMES = T.let(T.unsafe(nil), Hash)
683
+
684
+ # Represents a single WebSocket frame as defined by RFC 6455.
685
+ #
686
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:15
687
+ class Protocol::WebSocket::Frame
688
+ include ::Comparable
689
+
690
+ # @parameter mask [Boolean | String] An optional 4-byte string which is used to mask the payload.
691
+ #
692
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:26
693
+ def initialize(finished = T.unsafe(nil), payload = T.unsafe(nil), flags: T.unsafe(nil), opcode: T.unsafe(nil), mask: T.unsafe(nil)); end
694
+
695
+ # Compare this frame to another frame by their array representation.
696
+ # @parameter other [Frame] The frame to compare against.
697
+ # @returns [Integer] A comparison result (-1, 0, or 1).
698
+ #
699
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:48
700
+ def <=>(other); end
701
+
702
+ # Apply this frame to the connection by dispatching it to the appropriate handler.
703
+ # @parameter connection [Connection] The WebSocket connection to receive this frame.
704
+ #
705
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:167
706
+ def apply(connection); end
707
+
708
+ # Check whether this frame is a continuation fragment (FIN bit not set).
709
+ # @returns [Boolean] `true` if the FIN bit is not set.
710
+ #
711
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:77
712
+ def continued?; end
713
+
714
+ # Check whether this is a control frame (opcode has bit 3 set).
715
+ # @returns [Boolean] `true` if this is a control frame.
716
+ #
717
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:60
718
+ def control?; end
719
+
720
+ # @returns [Boolean] if the frame contains data.
721
+ #
722
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:65
723
+ def data?; end
724
+
725
+ # The generic frame header uses the following binary representation:
726
+ #
727
+ # 0 1 2 3
728
+ # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
729
+ # +-+-+-+-+-------+-+-------------+-------------------------------+
730
+ # |F|R|R|R| opcode|M| Payload len | Extended payload length |
731
+ # |I|S|S|S| (4) |A| (7) | (16/64) |
732
+ # |N|V|V|V| |S| | (if payload len==126/127) |
733
+ # +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
734
+ # + - - - - - - - - - - - - - - - +-------------------------------+
735
+ # +-------------------------------+-------------------------------+
736
+ # +-------------------------------- - - - - - - - - - - - - - - - +
737
+ # + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
738
+ # +---------------------------------------------------------------+
739
+ #
740
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:102
741
+ def finished; end
742
+
743
+ # The generic frame header uses the following binary representation:
744
+ #
745
+ # 0 1 2 3
746
+ # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
747
+ # +-+-+-+-+-------+-+-------------+-------------------------------+
748
+ # |F|R|R|R| opcode|M| Payload len | Extended payload length |
749
+ # |I|S|S|S| (4) |A| (7) | (16/64) |
750
+ # |N|V|V|V| |S| | (if payload len==126/127) |
751
+ # +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
752
+ # + - - - - - - - - - - - - - - - +-------------------------------+
753
+ # +-------------------------------+-------------------------------+
754
+ # +-------------------------------- - - - - - - - - - - - - - - - +
755
+ # + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
756
+ # +---------------------------------------------------------------+
757
+ #
758
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:102
759
+ def finished=(_arg0); end
760
+
761
+ # Check whether this is the final frame in a message.
762
+ # @returns [Boolean] `true` if the FIN bit is set.
763
+ #
764
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:71
765
+ def finished?; end
766
+
767
+ # Check whether the specified RSV flag bit is set on this frame.
768
+ # @parameter value [Integer] The flag bitmask to test (e.g. `RSV1`).
769
+ # @returns [Boolean] `true` if the flag bit is set.
770
+ #
771
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:41
772
+ def flag?(value); end
773
+
774
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:103
775
+ def flags; end
776
+
777
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:103
778
+ def flags=(_arg0); end
779
+
780
+ # The byte length of the payload.
781
+ # @returns [Integer | nil]
782
+ #
783
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:110
784
+ def length; end
785
+
786
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:105
787
+ def mask; end
788
+
789
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:105
790
+ def mask=(_arg0); end
791
+
792
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:104
793
+ def opcode; end
794
+
795
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:104
796
+ def opcode=(_arg0); end
797
+
798
+ # Pack the given data into this frame's payload, applying masking if configured.
799
+ # @parameter data [String] The payload data to pack.
800
+ # @returns [Frame] Returns `self`.
801
+ #
802
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:141
803
+ def pack(data = T.unsafe(nil)); end
804
+
805
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:106
806
+ def payload; end
807
+
808
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:106
809
+ def payload=(_arg0); end
810
+
811
+ # Convert this frame to an array of its fields for comparison or inspection.
812
+ # @returns [Array] An array of `[finished, flags, opcode, mask, payload]`.
813
+ #
814
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:54
815
+ def to_ary; end
816
+
817
+ # Unpack the raw payload, removing masking if present.
818
+ # @returns [String] The unmasked payload data.
819
+ #
820
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:157
821
+ def unpack; end
822
+
823
+ private
824
+
825
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:115
826
+ def mask_xor(data, mask); end
827
+ end
828
+
829
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:23
830
+ Protocol::WebSocket::Frame::OPCODE = T.let(T.unsafe(nil), Integer)
831
+
832
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:21
833
+ Protocol::WebSocket::Frame::RESERVED = T.let(T.unsafe(nil), Integer)
834
+
835
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:18
836
+ Protocol::WebSocket::Frame::RSV1 = T.let(T.unsafe(nil), Integer)
837
+
838
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:19
839
+ Protocol::WebSocket::Frame::RSV2 = T.let(T.unsafe(nil), Integer)
840
+
841
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/frame.rb:20
842
+ Protocol::WebSocket::Frame::RSV3 = T.let(T.unsafe(nil), Integer)
843
+
844
+ # When the frame payload does not match expectations.
845
+ #
846
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/error.rb:62
847
+ class Protocol::WebSocket::FrameSizeError < ::Protocol::WebSocket::ProtocolError; end
848
+
849
+ # Wraps an underlying {Async::IO::Stream} for reading and writing binary data into structured frames.
850
+ #
851
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/framer.rb:32
852
+ class Protocol::WebSocket::Framer
853
+ # Initialize a new framer wrapping the given stream.
854
+ # @parameter stream [IO] The underlying stream to read from and write to.
855
+ # @parameter frames [Hash] A mapping of opcodes to frame classes.
856
+ #
857
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/framer.rb:36
858
+ def initialize(stream, frames = T.unsafe(nil)); end
859
+
860
+ # Close the underlying stream.
861
+ #
862
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/framer.rb:42
863
+ def close; end
864
+
865
+ # Flush the underlying stream.
866
+ #
867
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/framer.rb:47
868
+ def flush; end
869
+
870
+ # Read a frame from the underlying stream.
871
+ # @returns [Frame] the frame read from the stream.
872
+ #
873
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/framer.rb:53
874
+ def read_frame(maximum_frame_size = T.unsafe(nil)); end
875
+
876
+ # Write a frame to the underlying stream.
877
+ # @parameter frame [Frame] The frame to serialize and write.
878
+ # @raises [ProtocolError] If the frame has an invalid mask.
879
+ #
880
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/framer.rb:123
881
+ def write_frame(frame); end
882
+ end
883
+
884
+ # @namespace
885
+ #
886
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/headers.rb:12
887
+ module Protocol::WebSocket::Headers; end
888
+
889
+ # Provides utilities for generating and verifying the WebSocket handshake nonce.
890
+ #
891
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/headers.rb:28
892
+ module Protocol::WebSocket::Headers::Nounce
893
+ class << self
894
+ # Valid for the `SEC_WEBSOCKET_ACCEPT` header.
895
+ #
896
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/headers.rb:37
897
+ def accept_digest(key); end
898
+
899
+ # Valid for the `SEC_WEBSOCKET_KEY` header.
900
+ #
901
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/headers.rb:32
902
+ def generate_key; end
903
+ end
904
+ end
905
+
906
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/headers.rb:29
907
+ Protocol::WebSocket::Headers::Nounce::GUID = T.let(T.unsafe(nil), String)
908
+
909
+ # The protocol string used for the `upgrade:` header (HTTP/1) and `:protocol` pseudo-header (HTTP/2).
910
+ #
911
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/headers.rb:14
912
+ Protocol::WebSocket::Headers::PROTOCOL = T.let(T.unsafe(nil), String)
913
+
914
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/headers.rb:23
915
+ Protocol::WebSocket::Headers::SEC_WEBSOCKET_ACCEPT = T.let(T.unsafe(nil), String)
916
+
917
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/headers.rb:25
918
+ Protocol::WebSocket::Headers::SEC_WEBSOCKET_EXTENSIONS = T.let(T.unsafe(nil), String)
919
+
920
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/headers.rb:22
921
+ Protocol::WebSocket::Headers::SEC_WEBSOCKET_KEY = T.let(T.unsafe(nil), String)
922
+
923
+ # The WebSocket protocol header, used for application level protocol negotiation.
924
+ #
925
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/headers.rb:17
926
+ Protocol::WebSocket::Headers::SEC_WEBSOCKET_PROTOCOL = T.let(T.unsafe(nil), String)
927
+
928
+ # The WebSocket version header. Used for negotiating binary protocol version.
929
+ #
930
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/headers.rb:20
931
+ Protocol::WebSocket::Headers::SEC_WEBSOCKET_VERSION = T.let(T.unsafe(nil), String)
932
+
933
+ # The maximum allowed frame size in bytes.
934
+ #
935
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/framer.rb:29
936
+ Protocol::WebSocket::MAXIMUM_ALLOWED_FRAME_SIZE = T.let(T.unsafe(nil), Integer)
937
+
938
+ # Represents a message that can be sent or received over a WebSocket connection.
939
+ #
940
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/message.rb:12
941
+ class Protocol::WebSocket::Message
942
+ # Create a new message from a buffer.
943
+ # @attribute buffer [String] The message buffer.
944
+ #
945
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/message.rb:15
946
+ def initialize(buffer = T.unsafe(nil)); end
947
+
948
+ # Compare this message to another message or buffer.
949
+ #
950
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/message.rb:28
951
+ def ==(other); end
952
+
953
+ # @attribute [String] The message buffer.
954
+ #
955
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/message.rb:20
956
+ def buffer; end
957
+
958
+ # The encoding of the message buffer.
959
+ # @returns [Encoding]
960
+ #
961
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/message.rb:39
962
+ def encoding; end
963
+
964
+ # Parse the message buffer using the given coder. Defaults to JSON.
965
+ #
966
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/message.rb:51
967
+ def parse(coder = T.unsafe(nil)); end
968
+
969
+ # Send this message as a text frame over the given connection.
970
+ # @parameter connection [Connection] The WebSocket connection to send through.
971
+ #
972
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/message.rb:62
973
+ def send(connection, **options); end
974
+
975
+ # @returns [Integer] The size of the message buffer.
976
+ #
977
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/message.rb:23
978
+ def size; end
979
+
980
+ # Convert the message buffer to a hash using the given coder. Defaults to JSON.
981
+ #
982
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/message.rb:56
983
+ def to_h(*, **, &); end
984
+
985
+ # A message is implicitly convertible to it's buffer.
986
+ #
987
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/message.rb:33
988
+ def to_str; end
989
+
990
+ class << self
991
+ # Generate a message from a value using the given coder.
992
+ # @property value [Object] The value to encode.
993
+ # @property coder [Coder] The coder to use. Defaults to JSON.
994
+ #
995
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/message.rb:46
996
+ def generate(value, coder = T.unsafe(nil)); end
997
+ end
998
+ end
999
+
1000
+ # Represents a ping frame that is sent or received by a WebSocket connection.
1001
+ #
1002
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/ping_frame.rb:12
1003
+ class Protocol::WebSocket::PingFrame < ::Protocol::WebSocket::Frame
1004
+ # Apply this frame to the specified connection.
1005
+ #
1006
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/ping_frame.rb:22
1007
+ def apply(connection); end
1008
+
1009
+ # Generate a suitable reply.
1010
+ # @returns [PongFrame]
1011
+ #
1012
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/ping_frame.rb:17
1013
+ def reply(**options); end
1014
+ end
1015
+
1016
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/ping_frame.rb:13
1017
+ Protocol::WebSocket::PingFrame::OPCODE = T.let(T.unsafe(nil), Integer)
1018
+
1019
+ # Represents a ping message that can be sent over a WebSocket connection.
1020
+ #
1021
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/message.rb:81
1022
+ class Protocol::WebSocket::PingMessage < ::Protocol::WebSocket::Message
1023
+ # Send this message as a ping frame over the given connection.
1024
+ # @parameter connection [Connection] The WebSocket connection to send through.
1025
+ #
1026
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/message.rb:84
1027
+ def send(connection); end
1028
+ end
1029
+
1030
+ # Represents a pong frame that is sent or received by a WebSocket connection.
1031
+ #
1032
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/pong_frame.rb:11
1033
+ class Protocol::WebSocket::PongFrame < ::Protocol::WebSocket::Frame
1034
+ # Apply this frame to the specified connection.
1035
+ #
1036
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/pong_frame.rb:15
1037
+ def apply(connection); end
1038
+ end
1039
+
1040
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/pong_frame.rb:12
1041
+ Protocol::WebSocket::PongFrame::OPCODE = T.let(T.unsafe(nil), Integer)
1042
+
1043
+ # Raised by stream or connection handlers, results in GOAWAY frame which signals termination of the current connection. You *cannot* recover from this exception, or any exceptions subclassed from it.
1044
+ #
1045
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/error.rb:43
1046
+ class Protocol::WebSocket::ProtocolError < ::Protocol::WebSocket::Error
1047
+ # Initialize a protocol error with an optional status code.
1048
+ # @parameter message [String] The error message.
1049
+ # @parameter code [Integer] The WebSocket status code associated with the error.
1050
+ #
1051
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/error.rb:47
1052
+ def initialize(message, code = T.unsafe(nil)); end
1053
+
1054
+ # @attribute [Integer] The status code associated with the error.
1055
+ #
1056
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/error.rb:54
1057
+ def code; end
1058
+ end
1059
+
1060
+ # Represents a text frame that is sent or received by a WebSocket connection.
1061
+ #
1062
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/text_frame.rb:13
1063
+ class Protocol::WebSocket::TextFrame < ::Protocol::WebSocket::Frame
1064
+ # Apply this frame to the specified connection.
1065
+ #
1066
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/text_frame.rb:34
1067
+ def apply(connection); end
1068
+
1069
+ # @returns [Boolean] if the frame contains data.
1070
+ #
1071
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/text_frame.rb:17
1072
+ def data?; end
1073
+
1074
+ # Decode the binary buffer into a suitable text message.
1075
+ # @parameter buffer [String] The binary data to unpack.
1076
+ #
1077
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/text_frame.rb:23
1078
+ def read_message(buffer); end
1079
+ end
1080
+
1081
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/text_frame.rb:14
1082
+ Protocol::WebSocket::TextFrame::OPCODE = T.let(T.unsafe(nil), Integer)
1083
+
1084
+ # Represents a text message that can be sent or received over a WebSocket connection.
1085
+ #
1086
+ # pkg:gem/protocol-websocket#lib/protocol/websocket/message.rb:68
1087
+ class Protocol::WebSocket::TextMessage < ::Protocol::WebSocket::Message; end