Livekit API Error

Don’t know why, but getting this errors for multiple calls.
The call goes well but at the end the error is getting triggered :

  1. livekit_api::signal_client::signal_stream:371:livekit_api::signal_client::signal_stream - failed to send pong message: Protocol(SendAfterClosing)
  2. livekit_api::signal_client::signal_stream:413:livekit_api::signal_client::signal_stream - unhandled websocket message Err(Io(Os { code: 104, kind: ConnectionReset, message: “Connection reset by peer” }))

What can be the reason?

These two log lines are harmless when they show up at the end of a call.

They come from the Rust SDK’s signal client (signal_stream.rs), which the Python SDK wraps.

What’s happening: when the session ends, the server closes the signal WebSocket, and two races can get logged as errors during that teardown:

  1. failed to send pong message: Protocol(SendAfterClosing) — the server sent a ping right before closing. The SDK queued a pong, but by the time it tried to send it, the socket was already closing.
  2. unhandled websocket message Err(Io(... ConnectionReset)) — the connection was dropped with a TCP reset instead of a graceful WebSocket close handshake. The read loop logs this before shutting down normally.

Both code paths end in exactly the same place a clean close would — the SDK is already tearing down the connection at that point. Since your calls are completing fine, you can safely ignore these.

The only time they’d be worth investigating is if you saw them mid-call, together with disconnects or reconnect attempts — that would point to a network issue between your agent and the server.

@CWilson Thank you for the clarification !