Skip to content

v9.1.1

Compare
Choose a tag to compare
@jondubois jondubois released this 05 Nov 02:53
· 405 commits to master since this release

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 the disconnect event could get triggered on the socket before the connection event had been triggered on the scServer 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 the disconnect only triggers after the handshake has completed. To catch a lost connection during the handshake phase, you should use the connectAbort event on the socket or connectionAbort 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 new close event or the server's new closure event. Note that this change does not affect the disconnection event on the server; only the disconnect event on the socket. Also note that this change should only affect you if you have written logic inside a scServer.on('handshake', handler) handler - If you just use the scServer.on('connection', handler) handler (and thus don't try to access sockets before they are fully connected), then the behaviour of disconnect will not have changed from what it was before.

Non-breaking changes

  • Added a new scServer.pendingClients property which is a hashmap similar to scServer.clients except that it contains sockets which have not yet completed the handshake (and therefore are still in the 'connecting' state). Also, a matching scServer.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 new connectAbort event was added to the socket and a matching connectionAbort event was added on the scServer object.
  • As mentioned in the 'potentially breaking changes' section above, a new catch-all close event has been added to the socket to replace the disconnect event which had ambiguous meaning. You can also listen to lost socket connections from the scServer using the closure event.