v9.1.1
This version fixes an issue with the scServer.clients
object and scServer.clientsCount
value not being updated correctly under certain specific scenarios. See SocketCluster/socketcluster-server#21
In addition to fixing the issue, this version introduces a few changes.
Potentially breaking changes
- On the server socket, the
disconnect
event used to trigger whenever the socket lost the connection at any stage of the handshake/connection cycle. That meant that thedisconnect
event could get triggered on the socket before theconnection
event had been triggered on thescServer
object (which was strange). Also there was no way to know the specific phase of the cycle when the connection ended (before or after the handshake). Now thedisconnect
only triggers after the handshake has completed. To catch a lost connection during the handshake phase, you should use theconnectAbort
event on the socket orconnectionAbort
event on the server. If you need a catch-all to capture any kind of connection termination at any phase of the cycle, you should now use the socket's newclose
event or the server's newclosure
event. Note that this change does not affect thedisconnection
event on the server; only thedisconnect
event on the socket. Also note that this change should only affect you if you have written logic inside ascServer.on('handshake', handler)
handler - If you just use thescServer.on('connection', handler)
handler (and thus don't try to access sockets before they are fully connected), then the behaviour ofdisconnect
will not have changed from what it was before.
Non-breaking changes
- Added a new
scServer.pendingClients
property which is a hashmap similar toscServer.clients
except that it contains sockets which have not yet completed the handshake (and therefore are still in the 'connecting' state). Also, a matchingscServer.pendingClientsCount
property was added. - The
connectAbort
event has been present on client sockets for a long time but not on server sockets until now. A newconnectAbort
event was added to the socket and a matchingconnectionAbort
event was added on thescServer
object. - As mentioned in the 'potentially breaking changes' section above, a new catch-all
close
event has been added to the socket to replace thedisconnect
event which had ambiguous meaning. You can also listen to lost socket connections from the scServer using theclosure
event.