Getting a persistent disconnect issue with our AppFoundry bot integration. The WebSocket connection to the Genesys Cloud media server drops exactly every 60 seconds. This causes a half-second audio gap for the caller, which is unacceptable. We’re using the standard WebSocket client in our Node.js bot handler. The connection opens fine, sends the initial handshake, and then just dies. No error event fires, just a close event with code 1001.
Here’s the connection setup:
const ws = new WebSocket('wss://api-us-east-1.genesis.cloud/websocket');
ws.on('open', () => {
console.log('Connected to media server');
ws.send(JSON.stringify({
type: 'handshake',
token: authHeader,
sessionId: callSessionId
}));
});
ws.on('close', (code, reason) => {
console.log(`Disconnected: ${code} ${reason}`);
// Reconnect logic here
});
The logs show the close event firing at :00, :60, :120 marks. It’s too regular to be network instability. I’ve checked the network logs and there’s no firewall blocking port 443. The token is valid for 2 hours. I’ve tried adding a heartbeat ping every 25 seconds, but the connection still drops at the 60-second mark. The ping doesn’t seem to reset the timer.
Is there a specific keep-alive mechanism required for AppFoundry bots? Or is this a known issue with the media server timeout? The docs mention a default idle timeout, but I’m sending data continuously during the conversation. The audio stream is active, so it shouldn’t be idle.
We’re on the US-East-1 region. The bot is running in a private AWS VPC. Direct connection via NAT gateway. No proxy in between.
Any ideas on how to extend the connection lifetime or prevent these drops?