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

**URL:** <https://mediasoup.discourse.group/t/is-there-any-way-to-detect-offline-user-using-medisoup-event-or-method/6701>\
**Category:** mediasoup libraries\
**Created:** [May 27, 2025, 6:43pm UTC](https://mediasoup.discourse.group/t/is-there-any-way-to-detect-offline-user-using-medisoup-event-or-method/6701 "2025-05-27T18:43:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![neerajcollab](https://avatars.discourse-cdn.com/v4/letter/n/53a042/32.png) [@neerajcollab](https://mediasoup.discourse.group/u/neerajcollab)\
**Post date:** [May 27, 2025, 6:43pm UTC](https://mediasoup.discourse.group/t/is-there-any-way-to-detect-offline-user-using-medisoup-event-or-method/6701/1 "2025-05-27T18:43:39Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![BronzedBroth](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@BronzedBroth](https://mediasoup.discourse.group/u/BronzedBroth)\
**Post date:** [May 27, 2025, 7:33pm UTC](https://mediasoup.discourse.group/t/is-there-any-way-to-detect-offline-user-using-medisoup-event-or-method/6701/2 "2025-05-27T19:33:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [May 28, 2025, 9:50am UTC](https://mediasoup.discourse.group/t/is-there-any-way-to-detect-offline-user-using-medisoup-event-or-method/6701/3 "2025-05-28T09:50:38Z")

</div>

> [@neerajcollab](#):
>
> transport.on(‘connectionstatechange’)

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.
