Intermittent WebSocket Disconnections Intermittent WebSocket Disconnections

Intermittent WebSocket Disconnections

Vonage API Support

Symptom

Users experience intermittent WebSocket disconnections when utilizing the Vonage Voice API. The disconnections occur both in local environments and when deployed in cloud environments, varying in time from about 30 seconds to 3 minutes into the call. The issue persists even with different SDK versions.

Applies To

  • Vonage Voice API
  • Deployment environments: Local and Cloud

Resolution

  1. Try a lower bitrate audio codec, such as audio/l16;rate=8000 instead of audio/l16;rate=16000.
  2. Send audio in smaller chunks if possible.
  3. Check server and load balancer logs for additional clues about the disconnections.
  4. Each message needs to be a 20ms sample of audio. At 8kHz the message should be 320 bytes. At 16kHz the message should be 640 bytes.

Cause

This issue can happen due to incorrect handling of audio throughput settings. Audio chunks configured as too large for the specified bitrate can cause disconnections.

Additional Information

For specific guidance on managing audio settings and WebSocket connections in Vonage APIs, refer to the Vonage API Developer Documentation on WebSockets.