We’ve got a hybrid setup running Genesys Cloud and NICE CXone, but this specific issue is isolated to our Genesys side. We’re using the AppFoundry WebSocket API to bridge our NICE Cognigy bot with the CTI platform. Everything works fine for short interactions, but once a call stretches past 4-5 minutes, the WebSocket connection drops hard. No graceful close event, just a Connection closed error in the browser console and the bot stops receiving audio chunks.
Here’s the connection setup we’re using in the AppFoundry widget:
const ws = new WebSocket(`wss://api.mypurecloud.com/api/v2/foundry/applications/${appId}/websocket`);
ws.onopen = () => {
console.log('Connected to Genesys WS');
ws.send(JSON.stringify({
type: 'register',
subscription: ['audio', 'metadata']
}));
};
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.type === 'audio') {
cessAudio(data.payload);
}
};
I’ve checked the server logs, and the Authorization token is valid. The initial handshake succeeds with a 101 Switching tocols. I’ve tried adding a heartbeat mechanism every 30 seconds, but the drop still happens. The audio latency starts creeping up to 800ms right before the disconnect, which makes me think it’s a buffer overflow or a timeout on the Genesys gateway side.
Has anyone hit this with Cognigy integrations? We’re not doing anything fancy with the payload, just passing base64 encoded PCM audio. The documentation doesn’t mention a max session duration for WebSockets, but it feels like there’s a hidden limit.
Also, the onclose event isn’t firing with a specific code, just 1006. Not helpful. If I restart the widget, it reconnects instantly, so it’s not a network issue.
Any ideas on how to keep the connection alive or handle the reconnection logic without dropping the call? We’re losing customers mid-sentence here.