JavaScript client for SocketCluster
Added support for batch unsubscribe.
Improved handling of badly formatted message.
Added a new close event which triggers on both disconnect and connectAbort.
Fixed broken tests due to expired auth tokens.
socket.authState
can no longer be in a 'pending'
(socket.PENDING
) state.
The 'pending'
authState
represented the ambiguous authentication state which might occur when the socket is disconnected/offline. It was removed because it was too ambiguous to be useful. Instead, socket.authState
now reports the last known authentication status (optimistic approach).
Once a socket is authenticated with a valid JWT, the socket will now report itself as being 'authenticated'
until the server explicitly indicates otherwise (e.g. the server invalidates the token).
Note that this only affects the authState
property and the events related to it. Pub/sub channels are not affected; the 'pending'
state
is still supported for SCChannel
objects (the meaning of 'pending'
is a lot clearer in that context).
socket.authState
and 'pending'
or socket.PENDING
may need to be reworked to deal with only two states: 'unauthenticated'
(socket.UNAUTHENTICATED
) and 'authenticated'
(socket.AUTHENTICATED
).'authStateChange'
event may be affected since there are now only two possible auth states instead of three.Internal cleanup.
autoSubscribeOnConnect
being false
and not yet having called the processSubscriptions
callback inside the 'connect' handler.priority
to each channel - This will determine the order in which subscriptions are sent to the server - This includes auto-resubscription when the socket recovers from a connection failure. The priority must be a number; the higher the priority, the sooner the subscription will be processed. So if you have socket.subscribe('bar').priority = 2;
and socket.subscribe('foo').priority = 3;
then the subscriptions will be sent to the server in the order foo
, bar
.autoProcessSubscriptions / autoSubscribeOnConnect
was set to false
. Note that if you aren't using the autoProcessSubscriptions / autoSubscribeOnConnect
option, then this bug will not affect you. If you do use autoProcessSubscriptions / autoSubscribeOnConnect
, then this bug may also not affect you (but this strictly depends on your specific use case).autoProcessSubscriptions
option has been renamed to autoSubscribeOnConnect
.Minor cleanup.