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
Damien Arrachequesne
443e447087
docs(examples): add example with WebTransport
2023-06-29 11:21:27 +02:00
Damien Arrachequesne
2f6cc2fa42
chore(release): 4.7.1
...
Diff: https://github.com/socketio/socket.io/compare/4.7.0...4.7.1
4.7.1
2023-06-28 09:32:32 +02:00
Damien Arrachequesne
0536fccfc2
chore(release): 4.7.1
...
Diff: https://github.com/socketio/socket.io-client/compare/4.7.0...4.7.1
2023-06-28 09:18:27 +02:00
Damien Arrachequesne
6169bb8782
chore: bump dev dependencies
2023-06-28 09:11:32 +02:00
Damien Arrachequesne
84ec6cf427
refactor: expose the ESM build with debug (bis)
...
This reverts the previous commit ([1]), and expose the ESM build that
includes the debug package on a subpath:
```js
import { io } from "socket.io-client/debug";
```
Reference: https://nodejs.org/api/packages.html#subpath-exports
Related: https://github.com/socketio/socket.io-client/issues/1586
[1]: 781d753a62
2023-06-28 09:11:24 +02:00
Damien Arrachequesne
630ff412a4
chore: bump engine.io-client to version 6.5.1
...
Diff: https://github.com/socketio/engine.io-client/compare/6.5.0...6.5.1
Release notes: https://github.com/socketio/engine.io-client/releases/tag/6.5.1
2023-06-28 08:56:49 +02:00
Damien Arrachequesne
500085dcf2
chore(release): 6.5.1
...
Diff: https://github.com/socketio/engine.io-client/compare/6.5.0...6.5.1
2023-06-28 08:44:52 +02:00
Damien Arrachequesne
a63066bdc8
fix: make closeOnBeforeunload default to false
...
Silently closing the connection when receiving a "beforeunload" event
is problematic, because it is emitted:
- when downloading a file from another host
Related: https://github.com/socketio/socket.io/issues/4436
- when the user already has a listener for the "beforeunload" event
(i.e. "are you sure you want to leave this page?")
Related:
- https://github.com/socketio/engine.io-client/issues/661
- https://github.com/socketio/engine.io-client/issues/658
- https://github.com/socketio/socket.io/issues/4065
That's why the `closeOnBeforeunload` option will now default to false.
2023-06-28 08:33:40 +02:00
Damien Arrachequesne
1fc61a3be5
refactor: expose the ESM build with debug (bis)
...
This reverts the previous commit ([1]), and expose the ESM build that
includes the debug package on a subpath:
```js
import { Socket } from "engine.io-client/debug";
```
Reference: https://nodejs.org/api/packages.html#subpath-exports
Related: https://github.com/socketio/socket.io-client/issues/1586
[1]: fe4d93ae20
2023-06-28 08:26:25 +02:00
Damien Arrachequesne
fe4d93ae20
refactor: expose the ESM build with debug
...
So that debug logs can be printed with vite:
```js
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
server: {
port: 4000
},
resolve: {
conditions: ["development"]
}
})
```
Reference: https://v2.vitejs.dev/config/#resolve-conditions
Related: 781d753a62
2023-06-27 15:00:05 +02:00
Damien Arrachequesne
6404391143
refactor: allow transportOptions to override all other options
...
Related: https://github.com/socketio/socket.io/issues/4719
2023-06-27 14:59:09 +02:00
Damien Arrachequesne
cf6aa1f43c
fix(webtransport): properly handle abruptly closed connections
2023-06-27 14:25:52 +02:00
Damien Arrachequesne
98915d0b61
chore(release): 6.5.1
...
Diff: https://github.com/socketio/engine.io/compare/6.5.0...6.5.1
2023-06-27 09:13:22 +02:00
Ben Weintraub
6dd2bc4f68
fix: prevent crash when accessing TextDecoder ( #684 )
...
The TextDecoder object was added on the global object in Node.js
v11.0.0, so older versions would throw:
> ReferenceError: TextDecoder is not defined
Reference: https://nodejs.org/api/util.html#new-textdecoderencoding-options
2023-06-27 09:01:26 +02:00
Damien Arrachequesne
00d8ee5b05
chore(release): 4.7.0
...
Diff: https://github.com/socketio/socket.io/compare/4.6.2...4.7.0
4.7.0
2023-06-22 11:27:45 +02:00
Damien Arrachequesne
9b235ec01d
chore(release): 4.7.0
...
Diff: https://github.com/socketio/socket.io-client/compare/4.6.2...4.7.0
2023-06-22 11:20:22 +02:00
Max Stepanov
f2892aba0b
fix: use same scope for setTimeout and clearTimeout calls ( #1568 )
...
Details:
- engine.io-client sets clearTimeoutFn and setTimeoutFn function
depending on settings passed to manager
- socker.io-client is using manager.setTimeoutFn to start connection
monitoring timer, but is using regular clearTimeout function to
stop it when connection is established
- in some setups it is causing timer fail to stop and it will break
connection every _timeout_ milliseconds (which is 20000 by default)
2023-06-22 09:33:11 +02:00
dependabot[bot]
87236baf87
chore: bump json5 from 2.1.3 to 2.2.3 ( #120 )
...
Bumps [json5](https://github.com/json5/json5 ) from 2.1.3 to 2.2.3.
- [Release notes](https://github.com/json5/json5/releases )
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md )
- [Commits](https://github.com/json5/json5/compare/v2.1.3...v2.2.3 )
---
updated-dependencies:
- dependency-name: json5
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-22 09:12:30 +02:00
dependabot[bot]
021618886a
chore: bump decode-uri-component from 0.2.0 to 0.2.2 ( #119 )
...
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component ) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases )
- [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2 )
---
updated-dependencies:
- dependency-name: decode-uri-component
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-22 09:12:16 +02:00
bitcoinfinancier
2d8b159e2a
chore: add security policy ( #124 )
2023-06-22 09:10:50 +02:00
Damien Arrachequesne
7594aa40c6
refactor: expose the ESM build with debug
...
So that debug logs can be printed with vite:
```js
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
server: {
port: 4000
},
resolve: {
conditions: ["development"]
}
})
```
Related: 781d753a62
2023-06-22 08:56:47 +02:00
Damien Arrachequesne
0eecad9185
refactor: export the isPacketValid() method
...
So that any custom parser does not have to implement their own.
Reference: https://socket.io/docs/v4/custom-parser/
2023-06-22 08:55:01 +02:00
Damien Arrachequesne
2dd5fa9dd4
ci: add Node.js 20 in the test matrix
...
Reference: https://github.com/nodejs/Release
2023-06-22 07:55:32 +02:00
Damien Arrachequesne
a5dff0ac83
docs(examples): increase httpd ProxyTimeout value (2)
2023-06-21 00:07:44 +02:00
Damien Arrachequesne
3035c25982
docs(examples): increase httpd ProxyTimeout value
...
With a value that is too small, the HTTP long-polling request receives
an HTTP 502 response code and the connection gets closed.
2023-06-20 23:57:46 +02:00
Damien Arrachequesne
5bc94b56bc
fix: properly report timeout error when connecting
...
In some specific cases (Node.js client with WebSocket only), the reason
attached to the "connect_error" event was "websocket error" instead of
"timeout".
Related: https://github.com/socketio/socket.io/issues/4062
2023-06-20 18:48:11 +02:00
Damien Arrachequesne
63f181cc12
feat: serve client bundles with CORS headers
...
The version of the `cors` package matches the one used by `engine.io`.
Related: https://github.com/socketio/socket.io/issues/3552
2023-06-20 14:32:59 +02:00
Ray Foss
781d753a62
feat: expose ESM build with debug ( #1585 )
...
So that debug logs can be printed with vite:
```js
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
server: {
port: 4000
},
resolve: {
conditions: ["development"]
}
})
```
Reference: https://v2.vitejs.dev/config/#resolve-conditions
Related:
- https://github.com/socketio/socket.io/issues/4731
- https://github.com/socketio/socket.io/issues/4635
- https://github.com/socketio/socket.io-client/issues/1516
2023-06-20 14:30:54 +02:00
Damien Arrachequesne
a250e283da
chore: bump engine.io to version 6.5.0
...
Diff: https://github.com/socketio/engine.io/compare/6.4.2...6.5.0
Release notes: https://github.com/socketio/engine.io/releases/tag/6.5.0
2023-06-20 09:17:10 +02:00
SyedTayyabUlMazhar
e5c62cad60
fix: remove the Partial modifier from the socket.data type ( #4740 )
...
Wrapping SocketData with Partial causes issues when reading data even
if you've made sure to pass all values. If someone want to make their
type Partial or make only a few properties optional, they can do so in
their own type instead.
Related: https://github.com/socketio/socket.io/issues/4537
2023-06-20 07:49:02 +02:00
Damien Arrachequesne
887396dbc2
ci: add Node.js 20 in the test matrix
...
Reference: https://github.com/nodejs/Release
2023-06-19 08:16:23 +02:00
Damien Arrachequesne
8f14b98fff
chore: bump engine.io-client to version 6.5.0
...
Diff: https://github.com/socketio/engine.io-client/compare/6.4.0...6.5.0
Release notes: https://github.com/socketio/engine.io-client/releases/tag/6.5.0
2023-06-16 12:40:51 +02:00
Damien Arrachequesne
01804d59c3
chore: update bundle
2023-06-16 11:59:43 +02:00
dependabot[bot]
9608781efe
chore(deps): bump engine.io from 6.2.1 to 6.4.2 in /examples/latency ( #678 )
...
Bumps [engine.io](https://github.com/socketio/engine.io ) from 6.2.1 to 6.4.2.
- [Release notes](https://github.com/socketio/engine.io/releases )
- [Changelog](https://github.com/socketio/engine.io/blob/main/CHANGELOG.md )
- [Commits](https://github.com/socketio/engine.io/compare/6.2.1...6.4.2 )
---
updated-dependencies:
- dependency-name: engine.io
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-16 11:42:09 +02:00
Damien Arrachequesne
1f640a2a0f
chore(release): 6.5.0
...
Diff: https://github.com/socketio/engine.io/compare/6.4.2...6.5.0
2023-06-16 11:36:09 +02:00
Damien Arrachequesne
4abc2ca3df
chore(release): 6.5.0
...
Diff: https://github.com/socketio/engine.io-client/compare/6.4.0...6.5.0
2023-06-16 11:05:41 +02:00
Damien Arrachequesne
9d37b16e6a
feat: favor WebTransport over WebSocket
...
This commit ensures that when there are multiple possible upgrades
(like WebSocket and WebTransport), then the WebTransport is favored and
the other upgrades are delayed.
Following 7195c0f305
2023-06-16 10:24:51 +02:00
Damien Arrachequesne
13d08bc0ac
test: fix randomly failing test
2023-06-16 10:22:32 +02:00
Damien Arrachequesne
1bfa9cd088
refactor: adapt to latest uWebSockets.js changes
...
Reference: https://github.com/uNetworking/uWebSockets.js/releases
2023-06-16 10:19:58 +02:00
Damien Arrachequesne
36724da521
refactor: cleanup URI creation
...
Following 7195c0f305
2023-06-13 17:57:01 +02:00