is there any way to detect offline user using medisoup event or method?

Hi everyone,

Is there a reliable way to detect when a user goes offline (client or server side) in mediasoup?

I’ve tried:

  • transport.on('dtlsstatechange')
  • transport.on('connectionstatechange')
  • transport.on('close')

But none of these work reliably when a user disconnects (e.g., network loss or browser closed). dtlsstatechange only triggers "connecting" or "connected" during reconnection, not "closed".

We can’t rely on socket disconnection because we support user reconnection.

Is there any recommended way (via transports, consumers, or producers) to detect when a user is truly offline?

Are your websockets isolated or something they don’t communicate/signal with the media servers?

There is no “connectionstatechange” in mediasoup server WebRtcTransport. So if you mean in client side, then specify it, please. And assuming that, “connectionstatechange” does work, but it may fire after 30 seconds of inactivity (that’s how ICE consent mechanism works) so you better rely on having your own ping/pong monitoring system on top of DataChannels or WebSocket or whatever.

1 Like