adk-samples icon indicating copy to clipboard operation
adk-samples copied to clipboard

fix issues #694: add connection timeout and improve error handling for bidi-demo WebSocket

Open wnqqnw19 opened this issue 2 months ago • 0 comments

Fixed the issue where bidi-demo would show "Connecting..." forever when the WebSocket connection failed or timed out.

Changes:
- Added 10-second connection timeout to detect failed connections
- Improved error handling in onerror handler with clearer error messages
- Enhanced onclose handler to properly handle different close codes
- Added timeout cleanup to prevent memory leaks
- Added user-friendly error messages when connection fails
- Prevented unnecessary reconnection attempts when connection times out

This ensures users get proper feedback when the server is not running or connection fails, instead of being stuck on "Connecting..." indefinitely.

wnqqnw19 avatar Dec 04 '25 19:12 wnqqnw19