Commit Graph

7703 Commits

Author SHA1 Message Date
Damien Arrachequesne
4f7edb46ec ci: enable caching of npm modules
Note: `npm ci` is always required because it's the npm cache that is cached, not the node_modules/ directory.

Reference: https://github.com/actions/setup-node
2026-04-02 17:40:35 +02:00
Damien Arrachequesne
85b26e5c99 ci: re-enable tests with fetch and uws
Tests were skipped since [1].

[1]: b837949479
2026-04-01 10:20:57 +02:00
Damien Arrachequesne
e4d016bd5b docs(security): add CVE-2026-33151
[skip ci]
2026-03-18 09:09:12 +01:00
Varun Chawla
8b93a18681 fix(sio): allow emitWithAck() for events with void callbacks (#5453)
EventNamesWithAck previously excluded events whose callback had no
non-error arguments (e.g. `(cb: () => void) => void` or
`(cb: (err: Error) => void) => void`). This made it impossible to use
emitWithAck as a simple acknowledgement mechanism without data.

The fix removes the FirstNonErrorArg void check while keeping the guard
against events with no parameters at all, so events like `() => void`
(no callback) are still correctly excluded.

Related: https://github.com/socketio/socket.io/issues/5257
2026-03-17 18:56:40 +01:00
Damien Arrachequesne
e6c722edbe docs: add changelog for socket.io-parser 3.3.5 and 3.4.4
[skip ci]
2026-03-17 18:39:54 +01:00
Damien Arrachequesne
8b0ab0a9d9 chore(release): socket.io-parser@4.2.6
Diff: https://github.com/socketio/socket.io/compare/socket.io-parser@4.2.5...socket.io-parser@4.2.6
2026-03-17 10:57:14 +01:00
Damien Arrachequesne
b25738c416 fix(parser): add a limit to the number of binary attachments
When a packet contains binary elements, the built-in parser does not modify them and simply sends them in their own WebSocket frame.

Example: `socket.emit("some event", Buffer.of(1,2,3))`

is encoded and transferred as:

- 1st frame: 51-["some event",{"_placeholder":true,"num":0}]
- 2nd frame: <buffer 01 02 03>

where:

- `5` is the type of the packet (binary message)
- `1` is the number of binary attachments
- `-` is the separator
- `["some event",{"_placeholder":true,"num":0}]` is the payload (including the placeholder)

On the receiving end, the parser reads the number of attachments and buffers them until they are all received.

Before this change, the built-in parser accepted any number of binary attachments, which could be exploited to make the server run out of memory.

The number of attachments is now limited to 10, which should be sufficient for most use cases.

The limit can be increased with a custom `parser`:

```js
import { Encoder, Decoder } from "socket.io-parser";

const io = new Server({
  parser: {
    Encoder,
    Decoder: class extends Decoder {
      constructor() {
        super({
          maxAttachments: 20
        });
      }
    }
  }
});
```
2026-03-17 10:57:13 +01:00
Sarthak Shah
f6301588ca fix(adapter): do not skip local broadcast when publishAndReturnOffset throws (#5457)
Remove the `return` in the catch block of ClusterAdapter.broadcast() so
that super.broadcast() is still called when remote publishing fails.

This ensures local sockets receive the event even if the cluster publish
errors out (e.g. due to a serialization error in the adapter layer).

Related: https://github.com/socketio/socket.io/issues/5456
2026-03-12 11:38:29 +01:00
Damien Arrachequesne
37aad11417 fix: cleanup pending acks on timeout to prevent memory leak
Related: https://github.com/socketio/socket.io/issues/4984
2026-03-11 18:26:52 +01:00
Damien Arrachequesne
ba9cd6900d revert: fix: cleanup pending acks on timeout to prevent memory leak
This reverts commit da04267ffc.

The reverted fix was incorrect because the rooms might have changed between the emit() and the timeout.
2026-03-11 18:26:30 +01:00
Damien Arrachequesne
84c2fb7821 chore(release): engine.io@6.6.6
Diff: https://github.com/socketio/socket.io/compare/engine.io@6.6.5...engine.io@6.6.6
engine.io@6.6.6
2026-03-10 10:52:10 +01:00
Not-Sarthak
07cbe1510d fix(eio): add @types/ws as dependency (#5458)
Since engine.io@6.6.5, the generated .d.ts files import types from "ws"
(WebSocket, PerMessageDeflateOptions), but @types/ws was not declared as
a dependency. This causes TypeScript compilation errors for consumers
who do not have @types/ws installed.

This follows the existing pattern where @types/cors and @types/node are
already listed as dependencies.

Related: https://github.com/socketio/socket.io/issues/5437
2026-03-04 09:54:58 +01:00
Erdinç Cürebal
44ed73f539 fix(eio): emit initial_headers and headers events in uServer (#5460)
The uServer (uWebSockets.js) implementation did not emit
"initial_headers" and "headers" events during WebSocket upgrades,
unlike the regular Server which does this via the ws "headers" event.

Related: https://github.com/socketio/socket.io/issues/5300
2026-03-04 09:07:02 +01:00
seungeonchoi
da04267ffc fix: cleanup pending acks on timeout to prevent memory leak (#5442)
When using `emitWithAck` with a timeout, if clients didn't respond
and the timeout triggers, the ack callbacks remained in `socket.acks`
Map indefinitely, causing a memory leak.

Related: https://github.com/socketio/socket.io/issues/4984
2026-03-02 16:32:13 +01:00
Damien Arrachequesne
74599a6b9e fix(types): properly import http module
This commit fixes `Module '"http"' has no default export.` errors (ts-node + esm).
2026-01-23 14:55:39 +01:00
Pádraic Slattery
d48718cb67 ci: use actions/checkout@v6 and actions/setup-node@v6 (#5449)
Release notes:

- https://github.com/actions/checkout/blob/main/CHANGELOG.md
- https://github.com/actions/setup-node/releases/tag/v6.0.0
2026-01-23 09:46:45 +01:00
Damien Arrachequesne
9978574e4f chore(release): socket.io@4.8.3
Diff: https://github.com/socketio/socket.io/compare/socket.io@4.8.2...socket.io@4.8.3
socket.io@4.8.3
2025-12-23 17:39:51 +01:00
Damien Arrachequesne
e9e5bed4f2 chore(release): socket.io-client@4.8.3
Diff: https://github.com/socketio/socket.io/compare/socket.io-client@4.8.2...socket.io-client@4.8.3
socket.io-client@4.8.3
2025-12-23 17:36:53 +01:00
Damien Arrachequesne
9581f9bcfd fix(sio): do not throw when calling io.close() on a stopped server
Following [1], calling both `io.close()` and `httpServer.close()` would throw an ERR_SERVER_NOT_RUNNING exception, which was not the case before.

Related: https://github.com/socketio/socket.io/issues/5431

[1]: bb0b480d2a
2025-12-23 17:30:15 +01:00
Damien Arrachequesne
579d43f33f refactor: remove unused files
[skip ci]
2025-12-23 13:34:44 +01:00
Damien Arrachequesne
ee9aac3134 chore(release): socket.io-parser@4.2.5
Diff: https://github.com/socketio/socket.io/compare/socket.io-parser@4.2.4...socket.io-parser@4.2.5
socket.io-parser@4.2.5
2025-12-23 12:26:38 +01:00
Damien Arrachequesne
968277cef8 chore(release): socket.io-adapter@2.5.6
Diff: https://github.com/socketio/socket.io/compare/socket.io-adapter@2.5.5...socket.io-adapter@2.5.6
socket.io-adapter@2.5.6
2025-12-23 12:18:53 +01:00
Damien Arrachequesne
2bf16bd214 chore(release): engine.io-client@6.6.4
Diff: https://github.com/socketio/socket.io/compare/engine.io-client@6.6.3...engine.io-client@6.6.4
engine.io-client@6.6.4
2025-12-23 12:03:43 +01:00
Damien Arrachequesne
ad616070b8 docs(eio): fix link in the release notes
[skip ci]
2025-12-22 17:53:09 +01:00
Damien Arrachequesne
dd71792455 chore(release): socket.io@4.8.2
Diff: https://github.com/socketio/socket.io/compare/socket.io@4.8.1...socket.io@4.8.2
socket.io@4.8.2
2025-12-22 17:42:41 +01:00
Ihor Machuzhak
bb0b480d2a fix(sio): improve io.close() function (#5344)
Before this change, `await io.close();` would resolve before the HTTP server was properly shut down.

Related: https://github.com/socketio/socket.io/pull/4971
2025-12-22 17:37:24 +01:00
Damien Arrachequesne
161be91975 test(sio): pin version of the client bundle in the tests 2025-12-22 17:35:35 +01:00
Damien Arrachequesne
fd9d4cab5e chore(release): socket.io-client@4.8.2
Diff: https://github.com/socketio/socket.io/compare/socket.io-client@4.8.1...socket.io-client@4.8.2
socket.io-client@4.8.2
2025-12-22 16:52:21 +01:00
Damien Arrachequesne
0a99ac44a2 chore(release): engine.io@6.6.5
Diff: https://github.com/socketio/socket.io/compare/engine.io@6.6.4...engine.io@6.6.5
engine.io@6.6.5
2025-12-22 16:27:31 +01:00
Damien Arrachequesne
4338f47336 ci(publish): use Node.js 24
Trusted publishing requires npm CLI version 11.5.1 or later.

Reference: https://docs.npmjs.com/trusted-publishers#for-github-actions
2025-12-22 16:27:30 +01:00
Damien Arrachequesne
9199156758 test(eio): fix flaky test 2025-12-22 15:27:48 +01:00
Damien Arrachequesne
594841617d test(redis-streams-emitter): migrate to Node.js test runner
We should eventually be able to replace:

- mocha and nyc with Node.js built-in test runner (`node:test`)
- expect.js with Node.js built-in assertion library (`node:assert`)
2025-12-22 14:48:29 +01:00
Denis Barbaron
84e7253e57 refactor(sio): add package.json entrypoint (#5239) 2025-12-22 14:33:12 +01:00
Damien Arrachequesne
30ec4a136a test(sio-client): reactivate all tests 2025-12-22 13:46:15 +01:00
Damien Arrachequesne
e08293bc37 refactor(eio): use URL constructor instead of url.parse() 2025-12-22 13:45:52 +01:00
Damien Arrachequesne
b837949479 ci: use Node.js 24
Reference: https://github.com/nodejs/Release
2025-12-22 13:45:36 +01:00
Damien Arrachequesne
118ef41b94 test: use tsx instead of ts-node 2025-12-22 10:39:57 +01:00
Suraj Rana
d19928e8d8 fix(sio-client): drain queue before emitting "connect" (#5259)
When the `retries` option was enabled, an event emitted in the "connect" handler would be sent twice.

Related: https://github.com/socketio/socket.io/issues/5258
2025-12-22 10:39:39 +01:00
Damien Arrachequesne
cdae01983a fix(sio-client): do not mangle the "_placeholder" attribute (bis)
The "_placeholder" attribute is used when sending binary data, and was
incorrectly mangled (converted to a random short property, like "it",
to reduce the bundle size).

Related:

- ca9e994815
- https://github.com/socketio/socket.io/issues/5215

[skip ci]
2025-12-19 15:48:28 +01:00
Damien Arrachequesne
39bb72039d docs: add release steps
[skip ci]
2025-12-19 15:43:14 +01:00
Valentin Rault
98741e15e9 refactor(sio-client): export DisconnectDescription type (#5392)
Related: https://github.com/socketio/socket.io/issues/4556
2025-12-19 14:51:39 +01:00
Damien Arrachequesne
8af70195bb refactor(sio): use URL constructor instead of url.parse()
Related: https://github.com/socketio/socket.io/issues/5377
2025-12-19 14:44:30 +01:00
Damien Arrachequesne
d88f3f4578 ci: use actions/checkout@v6 and actions/setup-node@v6
Release notes:

- https://github.com/actions/checkout/blob/main/CHANGELOG.md
- https://github.com/actions/setup-node/releases/tag/v6.0.0
2025-12-15 09:38:45 +01:00
Damien Arrachequesne
f5ee981ee8 ci(publish): use trusted publishing
Reference: https://docs.npmjs.com/trusted-publishers

[skip ci]
2025-12-15 08:57:17 +01:00
Damien Arrachequesne
76e3a72bba docs: add missing changelog links
[skip ci]
2025-12-15 08:55:26 +01:00
Damien Arrachequesne
a7b1938d06 test: regenerate SSL certs 2025-12-15 08:45:47 +01:00
Damien Arrachequesne
54743633ff chore(release): @socket.io/redis-streams-emitter@0.1.1
Diff: https://github.com/socketio/socket.io/compare/@socket.io/redis-streams-emitter@0.1.0...@socket.io/redis-streams-emitter@0.1.1
@socket.io/redis-streams-emitter@0.1.1
2025-11-07 10:33:07 +01:00
Damien Arrachequesne
7617707ed8 fix(redis-streams-emitter): remove dependency on socket.io-adapter
Related: https://github.com/socketio/socket.io/issues/5414
2025-11-07 10:28:27 +01:00
Damien Arrachequesne
599001d213 chore(release): @socket.io/redis-streams-emitter@0.1.0 @socket.io/redis-streams-emitter@0.1.0 2025-11-06 18:23:00 +01:00
Damien Arrachequesne
1c3e4711c1 feat: add emitter based on Redis streams
Related: https://github.com/socketio/socket.io-redis-streams-adapter/issues/8
2025-11-06 18:03:37 +01:00