WebSocket drops and audio lag in Genesys Cloud AppFoundry Cognigy integration

We’ve got a custom Android app wrapping the Genesys Cloud Web Messaging SDK for Kotlin. It’s talking to a NICE Cognigy bot hosted in AppFoundry. The text exchange works fine, but as soon as we switch to voice, the WebSocket connection drops every 15-20 seconds. The audio latency spikes to 2s before the disconnect.

Here’s the connection setup in our WebSocketManager:

val url = "wss://api.mypurecloud.com/api/v2/analytics/events"
val request = Request.Builder()
 .url(url)
 .header("Authorization", "Bearer $token")
 .build()

client.newWebSocket(request, object : WebSocketListener() {
 override fun onOpen(webSocket: WebSocket, response: Response) {
 Log.d("WS", "Connected")
 }
 override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) {
 Log.e("WS", "Failed: ${t.message}")
 // Retry logic here
 }
})

The onFailure callback throws SocketException: Connection reset by peer. I’ve checked the Genesys Cloud logs and see the disconnect event firing with reason: "transport_closed".

Is there a specific keep-alive mechanism we’re missing in the Kotlin implementation? The Cognigy bot doesn’t seem to be sending heartbeats. We’ve tried adding a simple ping every 10s, but it doesn’t help. The audio chunks arrive late, then the socket dies.

Any ideas on how to stabilize this? The SDK docs are vague about voice over WebSocket in custom clients.