Skip to contentSkip to navigationSkip to topbar
Page toolsOn this pageProducts used
Looking for more inspiration?Visit the

31903: Stream - WebSocket - Connection Broken Pipe


ERROR: 31903

error-31903 page anchor
VOICE
ERROR

Twilio returns this error when a Media Stream WebSocket connection is abruptly closed by the server while the Stream is active. Media Streams use a WebSocket connection to stream call audio to your application, and Twilio must be able to reach your server over a secure WebSocket connection.

Possible causes

possible-causes page anchor
  • Your WebSocket server is down or restarted while the Stream is still active.
  • Your WebSocket server encountered an application or infrastructure problem that caused it to close the connection unexpectedly.
  • The connection between Twilio and your WebSocket server was lost.
  • A firewall, proxy, load balancer, or other intermediate network element interrupted traffic between Twilio and your WebSocket server.
  • Verify that your WebSocket server process is running and stays available for the full duration of the Stream.
  • Review your server logs for crashes, restarts, unhandled exceptions, or connection close events that line up with the failed Stream.
  • Confirm that your Media Stream endpoint accepts secure WebSocket connections over wss and that Twilio can reach it on TCP port 443.
  • Review your firewalls, proxies, and load balancers for idle timeouts, resets, or routing issues that can close the TCP socket before the Stream ends.
  • If you are using bidirectional Media Streams, make sure your application closes the connection intentionally only when you want to stop the Stream or end the call.

Additional resources

additional-resources page anchor