Commit Graph

4079 Commits

Author SHA1 Message Date
Damien Arrachequesne
c508501d86 Merge remote-tracking branch 'socket.io-protocol/v3'
Source: https://github.com/socketio/socket.io-protocol/tree/v3
2024-07-04 18:30:39 +02:00
Damien Arrachequesne
bbcad832fa Merge remote-tracking branch 'socket.io-protocol/v4'
Source: https://github.com/socketio/socket.io-protocol/tree/v4
2024-07-04 18:29:51 +02:00
Damien Arrachequesne
f1c8410c3e refactor: prepare the migration to a monorepo 2024-07-04 18:29:15 +02:00
Damien Arrachequesne
93b42f6b77 refactor: prepare the migration to a monorepo 2024-07-04 18:27:57 +02:00
Damien Arrachequesne
dfac908769 Merge remote-tracking branch 'socket.io-protocol/main'
Source: https://github.com/socketio/socket.io-protocol
2024-07-04 18:25:43 +02:00
Damien Arrachequesne
b4002c281f refactor: prepare the migration to a monorepo 2024-07-04 18:23:59 +02:00
Damien Arrachequesne
4cac3724ad chore: update the repository URLs
Reference: https://docs.npmjs.com/cli/v10/configuring-npm/package-json
2024-07-04 18:16:51 +02:00
Damien Arrachequesne
914716d71d ci: move building the examples to its own workflow 2024-07-04 18:08:06 +02:00
Damien Arrachequesne
d9b4c3cb03 ci: create npm workspaces and sort out dependencies
This requires at least npm v7.

Reference: https://docs.npmjs.com/cli/v10/using-npm/workspaces

Note: @types/node is pinned at `18.15.3` because it's the last version
which supports TypeScript v4.2.
2024-07-04 17:48:46 +02:00
Damien Arrachequesne
7aedc79436 Merge remote-tracking branch 'socket.io-parser/main' into monorepo
Source: https://github.com/socketio/socket.io-parser
2024-07-04 17:38:27 +02:00
Damien Arrachequesne
bd02c7234a refactor: prepare the migration to a monorepo 2024-07-04 17:37:35 +02:00
Damien Arrachequesne
b2cf3f72fd Merge remote-tracking branch 'socket.io-client/main' into monorepo
Source: https://github.com/socketio/socket.io-client
2024-07-04 17:36:18 +02:00
Damien Arrachequesne
273093ceae refactor: prepare the migration to a monorepo 2024-07-04 17:35:42 +02:00
Damien Arrachequesne
d9d19b4bb7 refactor: prepare the migration to a monorepo 2024-07-04 17:33:59 +02:00
Damien Arrachequesne
88016b808a docs(security): update the list of CVE 2024-06-25 15:48:06 +02:00
Semih Han Ordu
fb5904ee5f chore(deps): bump ws to version 8.17.1 (#5052)
Includes the following security fix: e55e5106f1

Advisory: https://github.com/advisories/GHSA-3h5v-q93c-6h6q
Diff: https://github.com/websockets/ws/compare/8.11.0...8.17.1
2024-06-18 14:40:30 +02:00
Jakub Szaredko
579d34412a chore: fix compilation on macOS (#1616) 2024-06-11 12:30:57 +02:00
tnfAngel
31f10f6808 fix(types): make io#httpServer public (#5035)
Related: https://github.com/socketio/socket.io/issues/5034
2024-05-27 18:09:14 +02:00
pouria azad
89c4c7eb47 refactor(examples): minor tweak (#5017) 2024-05-10 05:00:20 +02:00
Gah Tang
239a2a82d0 fix: fix broadcasting from a parent namespace (#5009)
Following [1], emitting from a dynamic namespace to a room would throw
this error:

> node_modules/socket.io/dist/parent-namespace.js:88
>         this.children.forEach((nsp) => {
>                       ^
> 
> TypeError: Cannot read properties of undefined (reading 'forEach')
>     at ParentBroadcastAdapter.broadcast (node_modules/socket.io/dist/parent-namespace.js:88:23)
>    at BroadcastOperator.emit (node_modules/socket.io/dist/broadcast-operator.js:169:26)
>    at Socket.<anonymous> (server.js:60:33)
>    at Socket.emit (node:events:520:28)
>    at Socket.emitReserved (node_modules/socket.io/dist/typed-events.js:56:22)
>    at Socket._onclose (node_modules/socket.io/dist/socket.js:547:14)
>    at Client.onclose (node_modules/socket.io/dist/client.js:247:20)
>    at Socket.emit (node:events:532:35)
>    at Socket.onClose (node_modules/engine.io/build/socket.js:304:18)
>    at Object.onceWrapper (node:events:639:28)

Previous output code:

```js
class ParentNamespace extends namespace_1.Namespace {
    constructor(server) {
        super(server, "/_" + ParentNamespace.count++);
        this.children = new Set();
    }
    _initAdapter() {
        this.adapter = new ParentBroadcastAdapter(this, this.children);
    }
}
```

Here, `super()` calls `Namespace._initAdapter()`, but `this.children`
is not defined yet, hence the problem.

[1]: b9ce6a25d1

Related: https://github.com/socketio/socket.io/issues/4985
2024-04-26 15:36:26 +02:00
Damien Arrachequesne
b25e728da0 docs: update TypeScript example 2024-04-26 07:45:48 +02:00
Damien Arrachequesne
14d4997dbc docs: add example with NW.js 2024-04-12 11:13:31 +02:00
Damien Arrachequesne
907f102517 docs: update React Native example 2024-04-05 19:19:39 +02:00
Damien Arrachequesne
be2da4e4dc docs: add example with Nuxt 2024-03-29 10:00:23 +01:00
Damien Arrachequesne
61f444956b docs: add example with Next.js (with app router) 2024-03-27 11:02:03 +01:00
Damien Arrachequesne
b0568b20c1 docs: add example with Next.js (with pages router) 2024-03-25 18:05:22 +01:00
Damien Arrachequesne
50176812a1 chore(release): 4.7.5
Diff: https://github.com/socketio/socket.io/compare/4.7.4...4.7.5
4.7.5 socket.io@4.7.5
2024-03-14 17:55:23 +01:00
Damien Arrachequesne
4f6030f2c4 chore(release): 4.7.5
Diff: https://github.com/socketio/socket.io-client/compare/4.7.4...4.7.5
socket.io-client@4.7.5
2024-03-14 17:43:43 +01:00
Damien Arrachequesne
34cbfbb532 fix: discard acknowledgements upon disconnection
Previously, getting disconnected while waiting for an acknowledgement
would create a memory leak, as the acknowledgement was never received
and the handler would stay in memory forever.

This commit fixes the issue:

- handlers that do accept an error as first argument, such as:

* `socket.emit("test", (err, value) => { ... })` with `ackTimeout` option
* `socket.timeout(5000).emit("test", (err, value) => { ... })`
* `const value = await socket.emitWithAck("test")`

will now properly resolve with an error and get discarded.

- handlers that don't like `socket.emit("test", (value) => { ... });`
will simply be discarded upon disconnection

Note: the structure of the 'acks' attribute has been left untouched, in
order to prevent any breaking change.

Related:

- https://github.com/socketio/socket.io-client/issues/1546
- https://github.com/socketio/socket.io/issues/4964
2024-03-14 17:34:29 +01:00
Damien Arrachequesne
bf64870957 fix: close the adapters when the server is closed
Related:

- https://github.com/socketio/socket.io-mongo-adapter/issues/9
- https://github.com/socketio/socket.io-postgres-adapter/issues/13
- 0e23ff0cc6
2024-02-23 12:10:29 +01:00
Damien Arrachequesne
748e18c22e ci: test with older TypeScript version
Related: https://github.com/socketio/socket.io/issues/3891
2024-02-22 10:12:18 +01:00
Wang Guan
b9ce6a25d1 refactor: create specific adapter for parent namespaces (#4950) 2024-02-19 22:01:29 +01:00
Damien Arrachequesne
54dabe5bff ci: upgrade to actions/checkout@4 and actions/setup-node@4
Reference: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/
2024-02-12 18:16:10 +01:00
Damien Arrachequesne
e426f3e8e1 fix: remove duplicate pipeline when serving bundle
Related: https://github.com/socketio/socket.io/issues/4946
2024-02-12 18:11:38 +01:00
Damien Arrachequesne
e36062ca2d docs: update the webtransport example
Reference: https://github.com/fails-components/webtransport#changes-for-version-1xx
2024-01-17 13:01:57 +01:00
Damien Arrachequesne
0bbe8aec77 docs: only execute the passport middleware once
Before this change, the session and user context were retrieved once
per HTTP request and not once per session.
2024-01-13 17:56:17 +01:00
Damien Arrachequesne
914a8bd2b9 docs: add example with JWT
Related: https://github.com/socketio/socket.io/issues/4910
2024-01-13 17:14:01 +01:00
Damien Arrachequesne
d943c3e0b0 docs: update the Passport.js example 2024-01-12 17:08:19 +01:00
Damien Arrachequesne
6ab2509d52 chore(release): 4.7.4
Diff: https://github.com/socketio/socket.io/compare/4.7.3...4.7.4
4.7.4
2024-01-12 11:09:14 +01:00
Damien Arrachequesne
8cfea8c30b chore(release): 4.7.4
Diff: https://github.com/socketio/socket.io-client/compare/4.7.3...4.7.4
2024-01-12 11:03:23 +01:00
Zachary Soare
d9fb2f64b6 chore(tests): add a test for noArgs in a namespace 2024-01-08 06:38:57 +01:00
Zachary Soare
2c0a81cd87 chore(tests): fix issues due to client#id type change 2024-01-08 06:38:57 +01:00
Zachary Soare
f8d2644921 chore(tests): add type defs for expectjs and fix invalid expectations 2024-01-08 06:38:57 +01:00
Zachary Soare
04640d68cf chore(tests): indicate a future ts error with version 2024-01-08 06:38:57 +01:00
Zachary Soare
cb6d2e02aa fix(typings): calling io.emit with no arguments incorrectly errored
Refs: #4914
2024-01-08 06:38:57 +01:00
Damien Arrachequesne
80b2c34478 chore: bump socket.io-client version 2024-01-03 21:37:25 +01:00
Damien Arrachequesne
0d893196f8 chore(release): 4.7.3
Diff: https://github.com/socketio/socket.io/compare/4.7.2...4.7.3
4.7.3
2024-01-03 21:33:29 +01:00
Damien Arrachequesne
ca5d50ebac chore(release): 4.7.3
Diff: https://github.com/socketio/socket.io-client/compare/4.7.2...4.7.3
2024-01-03 21:25:21 +01:00
BCCSTeam
df8e70f798 fix: return the first response when broadcasting to a single socket (#4878) 2024-01-02 17:43:10 +01:00
Damien Arrachequesne
f9c16f2265 fix(typings): fix the type of the socket#id attribute
Related: https://github.com/socketio/socket.io/issues/4884
2024-01-02 15:55:56 +01:00