Search code examples
deepstream.io

Does deepstream clients unsubscribe when disconnecting?


From the docs:

The listen-callback is called with isSubscribed = true once a matching event is subscribed to for the first time and with isSubscribed = false once the last subscriber for a matching event unsubscribes.

If a browser client disconnects abruptly, will deepstream automatically unsubscribe it subscriptions eventually?


Solution

  • Yup, it will. Loosing a connection will automatically remove all subscriptions for that connection on the server side and also notify the listening mechanism in the process.

    In fact, even when a client just disconnects temporarily during a connection loss, all its subscriptions will be removed and re-established once it reconnects.