Releases: socketio/socket.io-adapter
Releases · socketio/socket.io-adapter
2.5.4
2.5.3
Two abstract classes were imported from the Redis adapter repository:
- the
ClusterAdapter
class, which manages the messages sent between the server instances of the cluster - the
ClusterAdapterWithHeartbeat
class, which extends theClusterAdapter
and adds a heartbeat mechanism in order to check the healthiness of the other instances
Other adapters can then just extend those classes and only have to implement the pub/sub mechanism (and not the internal chit-chat protocol):
class MyAdapter extends ClusterAdapterWithHeartbeat {
constructor(nsp, pubSub, opts) {
super(nsp, opts);
this.pubSub = pubSub;
pubSub.subscribe("main-channel", (message) => this.onMessage(message));
pubSub.subscribe("specific-channel#" + this.uid, (response) => this.onResponse(response));
}
doPublish(message) {
return this.pubSub.publish("main-channel", message);
}
doPublishResponse(requesterUid, response) {
return this.pubSub.publish("specific-channel#" + requesterUid, response);
}
}
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.
Bug Fixes
- cluster: fix count in fetchSockets() method (80af4e9)
- cluster: notify the other nodes when closing (0e23ff0)
Performance Improvements
- cluster: use timer.refresh() (d99a71b)
Links
- Diff: 2.5.2...2.5.3
2.5.2
The ws
dependency was moved from peerDependencies
to dependencies
, in order to prevent issues like this.
Links
- Diff: 2.5.1...2.5.2
2.5.1
2.5.0
Features
- implement connection state recovery (f529412)
Performance Improvements
- precompute the WebSocket frames when broadcasting (5f7b47d)
Links
- Diff: 2.4.0...2.5.0
2.4.0
2.3.3
Bug Fixes
- fix broadcasting volatile packets with binary attachments (88eee59)
Links
- Diff: 2.3.2...2.3.3
2.3.2
2.3.1
2.3.0
Features
- add a serverSideEmit empty function (c4cbd4b)
- add support for the "wsPreEncoded" writing option (5579d40)
Links
- Diff: 2.2.0...2.3.0