Hi experts,
I’m seeing a reproducible WebSocket issue with Gemini 3.1 Flash Live Preview.
Environment:
-
Android
-
OkHttp WebSocket
-
gemini-3.1-flash-live-preview -
v1alpha(and v1beta) GenerativeService.BidiGenerateContent
Client configuration:
.pingInterval(10, TimeUnit.SECONDS)
After about 170 seconds, the connection consistently fails with:
java.net.SocketTimeoutException:
sent ping but didn't receive pong within 10000ms
(after 15 successful ping/pongs)
The issue occurs even when the connection is completely idle (no audio streaming).
Using the exact same:
-
device
-
network
-
client code
-
OkHttp configuration
switching back to Gemini 2.5 Live (gemini-2.5-flash-native-audio-preview-12-2025) completely eliminates the problem.
One interesting observation is that the disconnect timing is highly deterministic:
16:45:31
16:48:23
16:51:14
The interval between failures is consistently around 172 seconds.
Also, before the timeout occurs, the client does not receive any Gemini control messages such as:
goAway
sessionResumptionUpdate
sessionResumption
or any other server message indicating that the session should be refreshed or resumed.
Additional findings:
I disabled OkHttp pingInterval entirely and reproduced the issue again.
Instead of a ping timeout, the server now closes the WebSocket with:
code=1008
reason=“The operation was aborted.”
Has anyone else seen similar ping/pong timeout behavior with Gemini 3.1 Flash Live Preview?
Thanks.