Skip to content

Commit 549156c

Browse files
chore(release): 2.5.3
Diff: 2.5.2...2.5.3
1 parent 5dcd182 commit 549156c

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

CHANGELOG.md

+44
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# History
22

3+
- [2.5.3](#253-2024-02-21) (Feb 2024)
34
- [2.5.2](#252-2023-01-12) (Jan 2023)
45
- [2.5.1](#251-2023-01-06) (Jan 2023)
56
- [2.5.0](#250-2023-01-06) (Jan 2023)
@@ -19,6 +20,49 @@
1920

2021
# Release notes
2122

23+
## [2.5.3](https://github.com/socketio/socket.io-adapter/compare/2.5.2...2.5.3) (2024-02-21)
24+
25+
Two abstract classes were imported from the [Redis adapter repository](https://github.com/socketio/socket.io-redis-adapter/blob/bd32763043a2eb79a21dffd8820f20e598348adf/lib/cluster-adapter.ts):
26+
27+
- the `ClusterAdapter` class, which manages the messages sent between the server instances of the cluster
28+
- the `ClusterAdapterWithHeartbeat` class, which extends the `ClusterAdapter` and adds a heartbeat mechanism in order to check the healthiness of the other instances
29+
30+
Other adapters can then just extend those classes and only have to implement the pub/sub mechanism (and not the internal chit-chat protocol):
31+
32+
```js
33+
class MyAdapter extends ClusterAdapterWithHeartbeat {
34+
constructor(nsp, pubSub, opts) {
35+
super(nsp, opts);
36+
this.pubSub = pubSub;
37+
pubSub.subscribe("main-channel", (message) => this.onMessage(message));
38+
pubSub.subscribe("specific-channel#" + this.uid, (response) => this.onResponse(response));
39+
}
40+
41+
doPublish(message) {
42+
return this.pubSub.publish("main-channel", message);
43+
}
44+
45+
doPublishResponse(requesterUid, response) {
46+
return this.pubSub.publish("specific-channel#" + requesterUid, response);
47+
}
48+
}
49+
```
50+
51+
Besides, the number of "timeout reached: only x responses received out of y" errors (which can happen when a server instance leaves the cluster) should be greatly reduced by [this commit](https://github.com/socketio/socket.io-adapter/commit/0e23ff0cc671e3186510f7cfb8a4c1147457296f).
52+
53+
54+
### Bug Fixes
55+
56+
* **cluster:** fix count in fetchSockets() method ([80af4e9](https://github.com/socketio/socket.io-adapter/commit/80af4e939c9caf89b0234ba1e676a3887c8d0ce6))
57+
* **cluster:** notify the other nodes when closing ([0e23ff0](https://github.com/socketio/socket.io-adapter/commit/0e23ff0cc671e3186510f7cfb8a4c1147457296f))
58+
59+
60+
### Performance Improvements
61+
62+
* **cluster:** use timer.refresh() ([d99a71b](https://github.com/socketio/socket.io-adapter/commit/d99a71b5588f53f0b181eee989ab2ac939f965db))
63+
64+
65+
2266
## [2.5.2](https://github.com/socketio/socket.io-adapter/compare/2.5.1...2.5.2) (2023-01-12)
2367

2468
The `ws` dependency was moved from `peerDependencies` to `dependencies`, in order to prevent issues like [this](https://github.com/socketio/socket.io-redis-adapter/issues/478).

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "socket.io-adapter",
3-
"version": "2.5.2",
3+
"version": "2.5.3",
44
"license": "MIT",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)