WebSocket drops during Cognigy handoff causing audio lag

Running into a weird issue with our AppFoundry integration. We’re bridging Genesys Cloud Web Messaging to a NICE Cognigy bot. The setup works fine for text, but as soon as we attempt a voice transfer or complex audio-based interaction via the WebSocket event stream, the connection drops after about 15 seconds.

I’ve got a simple Node.js listener for the events. It’s subscribing to webchat:messages and webchat:presence. The drop happens right when the Cognigy bot sends the handoff payload. Here’s the listener logic:

ws.on('message', (data) => {
 const msg = JSON.parse(data);
 if (msg.event === 'webchat:messages') {
 console.log('Received:', msg.data);
 }
});

The logs show a 1006: Abnormal Closure immediately after the bot responds. No 401s or auth errors in the Genesys logs. Just a hard disconnect.

Audio latency spikes to 300ms right before the drop. I’m guessing it’s a buffer issue or maybe the Cognigy endpoint isn’t keeping the WebSocket alive? We’re using the standard /api/v2/analytics/events/streams endpoint for the stream.

Has anyone seen this with Cognigy specifically? The SDK docs don’t mention timeout thresholds for bot handoffs. Checking if I need to send a heartbeat manually.