Damien Arrachequesne
43c1c1c1e2
refactor: simplify code
2023-11-09 12:13:15 +01:00
Damien Arrachequesne
3b5e79ef79
refactor: remove useless references
...
Those timers are only used during the upgrade, so there is no need to
keep those references in memory.
2023-11-09 12:05:38 +01:00
Damien Arrachequesne
f27a6c3501
refactor: remove useless reference
...
A reference to the initial IncomingMessage object (the first HTTP
request of the session) is kept in memory by default (`socket.request`),
so its attached ServerResponse object (`req.res`) would not be
garbage-collected. This will now be the case.
Note: the IncomingMessage object is needed in two cases:
- when working with the `express-session` middleware (`request.session`)
- when fetching the certificate of the client with `request.socket.getPeerCertificate()`
That's why removing it would be a breaking change.
2023-11-09 11:45:43 +01:00
Tyler Butler
605de78d2c
fix: improve compatibility with node16 module resolution ( #1595 )
...
Related:
- https://github.com/microsoft/TypeScript/issues/46770#issuecomment-966612103
- https://github.com/socketio/socket.io-client/issues/1589
2023-11-06 23:34:58 +01:00
James Baldassari
c1795ef568
refactor: export TransportError ( #709 )
2023-11-06 23:20:46 +01:00
Tyler Butler
46ef8512ed
fix: improve compatibility with node16 module resolution ( #711 )
...
Related:
- https://github.com/microsoft/TypeScript/issues/46770#issuecomment-966612103
- https://github.com/socketio/socket.io-client/issues/1589
2023-11-06 23:18:25 +01:00
dependabot[bot]
b96f0cb45a
chore: bump @babel/traverse from 7.9.5 to 7.23.2 ( #137 )
...
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse ) from 7.9.5 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases )
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md )
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse )
---
updated-dependencies:
- dependency-name: "@babel/traverse"
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-23 22:19:35 +02:00
Damien Arrachequesne
9f76ea22b4
ci: bump appiumVersion for Android tests in SauceLabs
...
> Error: Appium 1.22.1 does not support Android latest.
2023-10-23 22:18:28 +02:00
dependabot[bot]
9228596240
chore: bump @babel/traverse from 7.9.6 to 7.23.2 ( #126 )
...
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse ) from 7.9.6 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases )
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md )
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse )
---
updated-dependencies:
- dependency-name: "@babel/traverse"
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-23 22:17:11 +02:00
Damien Arrachequesne
d00ccd253d
ci: bump appiumVersion for Android tests in SauceLabs
...
> Error: Appium 1.22.1 does not support Android latest.
2023-10-23 11:54:38 +02:00
Damien Arrachequesne
9a2a83fdd4
refactor: cleanup after merge
2023-10-11 10:45:59 +02:00
Zachary Haber
f6ef267b03
refactor(typings): improve emit types ( #4817 )
...
This commit fixes several issues with emit types:
- calling `emit()` without calling `timeout()` first is now only available for events without acknowledgement
- calling `emit()` after calling `timeout()` is now only available for events with an acknowledgement
- calling `emitWithAck()` is now only available for events with an acknowledgement
- `timeout()` must be called before calling `emitWithAck()`
2023-10-11 10:37:13 +02:00
Maxime Kjaer
1cdf36bfea
test: build examples in the CI ( #3856 )
2023-10-10 20:02:52 +02:00
Toha
bbf1fdc7a6
docs: add Elephant.IO as PHP client library ( #4779 )
2023-10-10 17:32:19 +02:00
Damien Arrachequesne
2da559a8fa
chore(release): 6.5.3
...
Diff: https://github.com/socketio/engine.io/compare/6.5.2...6.5.3
2023-10-06 10:20:34 +02:00
Damien Arrachequesne
9545b44b3c
refactor: add cache-control header in the polling response
...
This header should not be needed since the client already includes a
cache busting query parameter ("t"), but a misconfigured CDN could
ignore the query parameters and cache the server response.
Related: https://github.com/socketio/socket.io/issues/4842
2023-10-05 17:19:08 +02:00
Damien Arrachequesne
ff1c861548
fix(webtransport): properly handle abruptly closed connections
...
Refreshing the page with a client connected with WebTransport would
trigger the following exception:
> node:internal/process/promises:288
> triggerUncaughtException(err, true /* fromPromise */);
> ^
>
> [UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "0".] {
> code: 'ERR_UNHANDLED_REJECTION'
> }
Related: https://github.com/socketio/engine.io/issues/688
2023-10-05 16:57:33 +02:00
Damien Arrachequesne
b4dc83eb9b
docs(examples): add codesandbox configuration
2023-09-20 12:57:37 +02:00
Damien Arrachequesne
ccbb4c0773
docs: add example with connection state recovery
2023-09-20 12:45:04 +02:00
Théodore Prévot
4f633dd6a4
docs: add test should close the connection if no handshake is received ( #31 )
2023-09-19 17:15:55 +02:00
Damien Arrachequesne
d744fda772
docs: improve example with express-session
...
The example is now available with different syntaxes:
- CommonJS
- ES modules
- TypeScript
Related: https://github.com/socketio/socket.io/pull/4787
2023-09-13 15:56:15 +02:00
Damien Arrachequesne
8259cdac84
docs: use io.engine.use() with express-session
...
Related: https://github.com/socketio/socket.io/discussions/4819
2023-09-13 12:13:03 +02:00
Damien Arrachequesne
3dcb88cb31
docs: add note about the agent option
...
Related: https://github.com/socketio/engine.io-client/pull/708
2023-09-13 11:58:29 +02:00
Avi Vahl
c6bf8c0f57
fix: improve compatibility with node16 module resolution ( #689 )
...
Related: https://github.com/microsoft/TypeScript/issues/46770#issuecomment-966612103
2023-08-17 07:59:32 +02:00
Damien Arrachequesne
fd9dd74eee
docs: use "connection" instead of "connect"
...
"connect" and "connection" have the same meaning, but "connection" is
the preferred version.
2023-08-12 10:10:55 +02:00
Damien Arrachequesne
9efa1d0aec
test: add more stream decoding tests
2023-08-05 00:34:20 +02:00
Damien Arrachequesne
c332643ad8
chore(release): 4.7.2
...
Diff: https://github.com/socketio/socket.io/compare/4.7.1...4.7.2
4.7.2
2023-08-03 01:51:04 +02:00
Damien Arrachequesne
3468a197af
fix(webtransport): properly handle WebTransport-only connections
...
A WebTransport-only connection has no `request` attribute, so we need
to handle that case.
2023-08-03 01:45:21 +02:00
Damien Arrachequesne
928d76d255
chore(release): 4.7.2
...
Diff: https://github.com/socketio/socket.io-client/compare/4.7.1...4.7.2
2023-08-03 01:40:17 +02:00
Damien Arrachequesne
09d45491c4
chore: bump engine.io to version 6.5.2
...
Diff: https://github.com/socketio/engine.io/compare/6.5.0...6.5.2
Release notes: https://github.com/socketio/engine.io/releases/tag/6.5.2
2023-08-03 00:39:46 +02:00
Damien Arrachequesne
74ca7ac0c7
chore: bump engine.io-client to version 6.5.2
...
Diff: https://github.com/socketio/engine.io-client/compare/6.5.1...6.5.2
Release notes: https://github.com/socketio/engine.io-client/releases/tag/6.5.2
2023-08-03 00:30:57 +02:00
Damien Arrachequesne
12ca32b534
chore(release): 6.5.2
...
Diff: https://github.com/socketio/engine.io/compare/6.5.1...6.5.2
2023-08-02 02:00:02 +02:00
Damien Arrachequesne
10970563bf
chore(release): 6.5.2
...
Diff: https://github.com/socketio/engine.io-client/compare/6.5.1...6.5.2
2023-08-02 01:57:14 +02:00
Chris Dewbery
ed34a45a07
refactor: reset ping timeout on any incoming packet ( #706 )
...
The client will now match the behavior of the server.
See also: be7b4e7478
2023-08-02 01:53:29 +02:00
Damien Arrachequesne
8270e00d5b
fix(webtransport): honor the binaryType attribute
...
The Node.js client will now properly receive binary data as Buffers
instead of ArrayBuffers, when connecting with WebTransport. Browser
clients will still receive ArrayBuffers though (or Blobs, if
`socket.binaryType` is set to "blob").
2023-08-02 01:48:38 +02:00
Damien Arrachequesne
d55c39e0ed
fix(webtransport): add proper framing
...
WebTransport being a stream-based protocol, the chunking boundaries are
not necessarily preserved. That's why we need a header indicating the
type of the payload (plain text or binary) and its length.
See also: a306db09e8
2023-08-02 01:42:23 +02:00
Damien Arrachequesne
a306db09e8
fix(webtransport): add proper framing
...
WebTransport being a stream-based protocol, the chunking boundaries are
not necessarily preserved. That's why we need a header indicating the
type of the payload (plain text or binary) and its length.
We will use a format inspired by the WebSocket frame:
- first bit indicates whether the payload is binary
- the next 7 bits are either:
- 125 or less: that's the length of the payload
- 126: the next 2 bytes represent the length of the payload
- 127: the next 8 bytes represent the length of the payload
Reference: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#decoding_payload_length
Related:
- https://github.com/socketio/engine.io/issues/687
- https://github.com/socketio/engine.io/issues/688
2023-08-02 01:00:42 +02:00
Damien Arrachequesne
58626c7edd
chore(release): 5.2.1
...
Diff: https://github.com/socketio/engine.io-parser/compare/5.2.0...5.2.1
2023-08-02 00:32:16 +02: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
aea321cadc
chore(release): 5.2.0
...
Diff: https://github.com/socketio/engine.io-parser/compare/5.1.0...5.2.0
2023-07-31 08:47:00 +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
2d0b75595c
chore: bump dev dependencies
2023-07-31 08:08:54 +02:00
Jaro
0731c0d2f4
fix: clean up child namespace when client is rejected in middleware ( #4773 )
...
Related: https://github.com/socketio/socket.io/issues/4772
2023-07-21 08:33:46 +02:00
Damien Arrachequesne
03046a64ad
docs: update the list of supported Node.js versions
...
The Engine.IO server uses `timeout.refresh()` (see [1]), which was
added in Node.js 10.2.0.
Reference: https://nodejs.org/api/timers.html#timeoutrefresh
Related: https://github.com/socketio/engine.io/issues/686
[1]: 37474c7e67
2023-07-09 10:14:49 +02:00
Damien Arrachequesne
7dd1350bf9
docs: update the list of supported Node.js versions
...
The server uses `timeout.refresh()` (see [1]), which was added in Node.js 10.2.0.
Reference: https://nodejs.org/api/timers.html#timeoutrefresh
Related: https://github.com/socketio/engine.io/issues/686
[1]: 37474c7e67
2023-07-09 10:08:50 +02:00
Damien Arrachequesne
56a53bceb9
ci: add Node.js 20 in the test matrix
2023-07-09 10:03:47 +02:00
Damien Arrachequesne
683720a67d
test: fix flaky test
2023-07-09 10:03:46 +02:00
Damien Arrachequesne
a529eb08d6
chore: bump dev dependencies
2023-07-09 10:03:32 +02:00
Théodore Prévot
05488c41f6
docs: improve test suite ( #46 )
...
The second WebSocket created after an upgrade should gracefully close
and not throw an error as specified the official implementation.
2023-07-08 08:34:14 +02:00
Sleeyax
723c7bab4d
docs: add test suite ( #45 )
2023-07-02 09:39:37 +02:00