Releases: SocketCluster/socketcluster
v17.3.1
v16.0.1
See website https://socketcluster.io/ for v16.x.x docs.
v14.3.0
v14.2.0
- Deprecated
setAuthEngine(authEngine)
andsetCodecEngine(codecEngine)
methods. You should now pass a customauthEngine
andcodecEngine
as options to theSCWorker
constructor. See theconstructor
method here: https://socketcluster.io/#!/docs/api-scworker
v14.1.1
- SCC: Added detailed error messages if some SCC components are not compatible with others.
- SCC: Fixed bug related to 'max stack size exceeded' error when a certain configuration is used.
- SCC: Renamed
SOCKETCLUSTER_SERVER_PORT
environment variable toSCC_BROKER_SERVER_PORT
.
Breaking change
- SCC:
v6.x.x
components have been released; from now on, the major version numbers of all SCC components (scc-state
,scc-broker
andscc-broker-client
) need to match each other.
v13.1.3
- You can now pass an optional
authVerifyAlgorithms
array (of strings) to the main SocketCluster instance (used for JWT auth verification). If not specified, by default the algorithm will be the same for both JWT signing and verification (determined byauthAlgorithm
). The consequence of this change is that while you can only sign with one algorithm, the verification could accept multiple algorithms. - The SC server adds a
socket
property to theoptions
object which is passed to theverifyToken
method of theauthEngine
; this means that if a customauthEngine
is provided, it can use data from the socket itself (e.g. cookie or query string) to aid in performing the verification. - Added a
destroy
method on the server side socket to make it more consistent with the client side socket. Also added a matchingactive
(boolean) property which can be used to check if the socket was destroyed. - An error event will be emitted on the socket if the user tries to emit a reserved event on that socket.
- Renamed
SCSocket
toSCServerSocket
. - Bumped
sc-uws
version.
v12.0.0
- Added a new
authStateChange
event on the server side socket (SCSocket) which is has similar behavior as theauthStateChange
event on the client-side SCSocket. - Added a new
authenticationStateChange
event on the server (SCServer) which is essentially the same as the socketauthStateChange
except that the first argument to the handler is a socket object and it captures the event across all active sockets. - Breaking changes to socketcluster-client https://github.com/SocketCluster/socketcluster-client/releases/tag/v12.0.0
v11.3.1
- Upgraded SCC:
-
[email protected]
(npm) -
Added support for skeleton-based rendezvous hashing by default - This means that adding or removing
scc-broker
instances to the cluster now requires fewer channel migrations that before - This means that downtime will affect a much smaller subset of channels when scaling out or scaling back. The more machines/instances there are in the cluster, the fewer channels will be affected when new machines/instances are added. You can use the old mapping engine by setting theclusterMappingEngine
option in SC to'simple'
here: https://github.com/SocketCluster/socketcluster/blob/72d301146c37efa3de52b8acfc532767c1ec6cc6/sample/server.js#L37 -
Added support for connection pooling so that a SocketCluster instance can now interact with an
scc-broker
instance through more connections; this is useful if you want to use largescc-broker
instances that have more than one worker process - In this case, it should help to distribute the load more evenly across processes inside thescc-broker
instance. You can set theclusterClientPoolSize
option in SC; it defaults to 1 - Ideally this number should remain in the single-digit range. See https://github.com/SocketCluster/socketcluster/blob/72d301146c37efa3de52b8acfc532767c1ec6cc6/sample/server.js#L38
-
- Made
ws
the default WebSocket engine for maximum compatibility; a large number of users have been complaining aboutuws
not working on some systems - It's better to have a default that always works out of the box (as not to scare away new users) and to make optimizations optional.
Breaking change
- Switched to a custom uWS JS binding/module
sc-uws
; it's a drop-in replacement foruws
.
v11.1.0
-
Upgraded SCC:
scc-state:v2.0.0
(Dockerhub)scc-broker:v2.0.0
(Dockerhub)[email protected]
(npm)
This upgrade was about simplifying and improving the stability and reliability of SCC. As part of this upgrade, SCC's graceful scale-out feature was removed in favour of a simpler approach; this means that scaling out the cluster may now incur a few seconds worth of lost messages on some channels; on the positive side, the cluster is now a lot more reliable overall. Some heavy users of SCC had reported occasional issues with channels going out of sync in earlier versions (which necessitated restarting nodes in the cluster). The new version is simpler and better tested (see https://github.com/SocketCluster/scc-integration-tests).
-
Made it so that 'unsubscribe' events will trigger before the 'disconnect' event on the server - Before it used to be inconsistent (depending on IPC latency between worker and broker processes).
v10.0.0
- Renamed
MIDDLEWARE_HANDSHAKE
property toMIDDLEWARE_HANDSHAKE_WS
to make it clear that it is executed as part of the low-level WebSocket protocol handshake (before the SocketCluster socket has been instantiated on the server side). This middleware line offers the earliest possible opportunity to block connections before they are made - The downside is that due to security restrictions in the WebSocket protocol, it is not possible to pass back custom errors to the client during this phase of the connection. - Added a new
MIDDLEWARE_HANDSHAKE_SC
middleware type which lets you control the flow at the SocketCluster protocol handshake level (this runs after theMIDDLEWARE_HANDSHAKE_WS
middleware). Unlike withMIDDLEWARE_HANDSHAKE_WS
, withMIDDLEWARE_HANDSHAKE_SC
, you can pass back custom status codes to the client when blocking requests; the client can use this status code to determine its behaviour. This middleware line can be used to authenticate sockets using HTTP query strings instead of JWT tokens.
Example:
var scServer = worker.scServer;
scServer.addMiddleware(scServer.MIDDLEWARE_HANDSHAKE_SC, (req, next) => {
setTimeout(() => {
var err = new Error('Failed MIDDLEWARE_HANDSHAKE_SC');
err.name = 'SCHandshakeError';
// Block connection with custom 4501 status code.
// The client will receive this code as the first argument
// to the 'disconnect' event handler.
next(err, 4501);
}, 200);
});
Breaking change
- Renamed
MIDDLEWARE_HANDSHAKE
property toMIDDLEWARE_HANDSHAKE_WS
- The corresponding string value was also renamed fromhandshake
tohandskakeWS
.