We’ve got a custom agent desktop built on AppFoundry that integrates with NICE Cognigy for bot handoffs. The flow is pretty standard: agent accepts a voice call, the bot handles initial qualification, then transfers to the agent. The issue is intermittent but annoying. Every 10 to 15 minutes, the WebSocket connection to the bot engine drops, or the audio latency spikes to over 2 seconds before snapping back.
I’m using the Genesys Cloud Embeddable Client App SDK (genesyscloud-client-app-sdk) to handle the media stream. Here’s how I’m initializing the connection in the main component:
const sdk = new GenesysCloudClientAppSdk({
environment: 'mypurecloud.com',
clientId: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET
});
sdk.on('connectionStateChange', (state) => {
console.log('Connection state:', state);
if (state === 'disconnected') {
// Attempt reconnection
sdk.connect();
}
});
The logs show the state flipping to disconnected right when the latency hits. I’ve checked the network tab, and the WebSocket frames are timing out on the wss://api.mypurecloud.com endpoint. I thought it might be a timeout setting, so I tried adjusting the pingInterval and pingTimeout in the underlying socket options, but that didn’t help.
Has anyone seen this behavior with Cognigy integrations specifically? Is there a specific header or payload I need to send to keep the bot session alive while the agent is on hold? The bot logs show the session is still active on their end, so it feels like a Genesys side drop.
I’ve also tried switching to the REST API for status checks, but that doesn’t solve the real-time audio issue. The audio stream seems to buffer up and then dump, causing the spike.