early-smartphone-1665
11/26/2025, 3:36 PMtall-airline-16756
11/26/2025, 3:36 PMtall-airline-16756
11/26/2025, 3:37 PMReconnecting event is emitted when the connection is interrupted and Reconnected if it recovers. If reconnection fails, Disconnected is emitted.
• Disconnect reason: a STATE_MISMATCH disconnect reason can be used when the media connection times out or the client/server fall out of sync due to network failure.
• Webhooks: the server can send participant_left (and related) webhook events that include participant/room details for unexpected drops.
• Agent framework: an agent CloseEvent is emitted when an agent loses connection; any error is included in the event's error property.
• Detection timing: ICE/STUN keep-alives detect media-path failure (server assumes dead after ~20s; clients often detect within ~15s) and trigger the above events.
If you want, tell me which SDK/client (web, iOS, Android, or Agents) you're using and whether you want sample code to listen for these events or how to map them to user-facing messages.
Sources: Understanding the STATE_MISMATCH Disconnect Reason | Connecting to LiveKit | LiveKit docs | Webhooks | LiveKit docs | server-sdk-ruby | livekit/livekit_composite | DeepWiki | Events and error handling | LiveKit docsearly-smartphone-1665
11/26/2025, 5:08 PMtall-airline-16756
11/26/2025, 5:08 PMReconnecting, Reconnected, and Disconnected to know when a client lost connectivity and whether it recovered.
• Disconnect reason: check the disconnection reason (e.g., STATE_MISMATCH) on `Disconnected`/close events to understand why the connection ended.
• Participant events/webhooks: subscribe to participant_left (or equivalent) webhooks/events — they include participant and room details so you can correlate unexpected exits.
• Agent framework: handle the CloseEvent and inspect its error property for any error details when an agent goes offline.
• Client-side detection: monitor ICE/STUN state and connection stats (e.g., no keep-alives, high packet loss, or long RTT) — these indicate network failure before a hard disconnect.
Next step: which SDK are you using (Web, iOS, Android, or Agents)? I can provide the exact event names and short sample code to capture the disconnect reason and surface it in your logs or UI.