Running into some nasty stability issues with our AppFoundry integration. We’re using the Genesys Cloud JavaScript SDK to connect to a NICE Cognigy bot via WebSocket. The connection initiates fine, but after about 45 seconds of idle time or during high load, the socket drops. When it reconnects, there’s a significant audio latency spike on the agent side, making the conversation unusable.
We’ve checked the server logs and see no errors on the Cognigy side. The issue seems to be in the client-side reconnection logic or how we’re handling the WebSocket state. Here’s the relevant snippet from our connection handler:
const client = new GenesysCloudPureCloudPlatformClient();
client.login().then(() => {
const websocket = new WebSocket('wss://api.us.genesys.cloud/v2/analytics/events');
websocket.onopen = () => {
console.log('Connected');
};
websocket.onclose = (event) => {
console.log('Disconnected:', event.code, event.reason);
// Reconnect logic here
setTimeout(() => connect(), 5000);
};
websocket.onmessage = (event) => {
const data = JSON.parse(event.data);
// cess event
};
});
The onclose event fires with code 1006 (Abnormal closure). We’re trying to handle this gracefully, but the reconnection causes the audio sync issue. We’ve tried adjusting the keep-alive settings in the SDK config, but nothing seems to stick.
Is there a specific way to handle WebSocket reconnections in the Genesys Cloud SDK that prevents this audio lag? Or are we missing a step in the Cognigy integration handshake? The docs are pretty thin on this edge case. We’re using the latest SDK version (2.0.145). Any insights would be appreciated. We’ve spent two days debugging this with no luck. The latency is killing our CSAT scores.