Commit Graph

6 Commits

Author SHA1 Message Date
Damien Arrachequesne
08cff77a48 chore: bump prettier to version 3
This change is necessary to be able to write "import type { ... }".
2024-02-05 18:20:30 +01:00
Damien Arrachequesne
0b5e98591e refactor: prepend a header to each WebTransport chunk
This commit updates the format of the header added in [1], in order to
match the format used for a WebSocket frame ([2]).

Two advantages:

- small payloads only need 1 byte instead of 4
- payloads larger than 2^31 bytes are supported

[1]: 6142324fa6
[2]: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#decoding_payload_length
2023-08-02 00:29:45 +02:00
Damien Arrachequesne
6142324fa6 feat: prepend a header to each WebTransport chunk
WebTransport is a stream-based protocol, so chunking boundaries are not
always preserved.

That's why we will now prepend a 4-bytes header to each chunk:

- first bit indicates whether the payload is plain text (0) or binary (1)
- next 31 bits indicate the length of the payload

See also: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#format
2023-07-31 08:09:27 +02:00
Damien Arrachequesne
bed70a4f25 feat: implement WebTransport-related encoding/decoding 2023-06-11 07:41:51 +02:00
Damien Arrachequesne
ad5bd7ddf5 refactor: add additional types
Merged from https://github.com/socketio/engine.io/pull/630
2022-01-17 10:23:16 +01:00
Damien Arrachequesne
e4d9fce4d8 chore: migrate to TypeScript
This change introduces an ESM build which will allow tree shaking. A
CJS build is also provided for backward compatibility.
2021-10-01 10:39:52 +02:00