WebSocket connection drops during Cognigy bot handoff in AppFoundry widget

The connection terminates right after the bot completes its first intent match.

WebSocket connection to 'wss://api-us-east-1.mygen.com/v2/analytics/eventstream?...' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET

We are building a custom AppFoundry widget that listens to conversation events via the Notification API WebSocket. The goal is to push state changes to New Relic for latency tracking. The connection stays alive during the IVR menu but drops immediately when the conversation routes to the NICE Cognigy bot.

Here is the subscription config:

const config = {
 filters: [
 {
 type: 'conversation',
 query: 'type:voice',
 fields: ['id', 'state', 'participants']
 }
 ]
};

const socket = new WebSocket(`wss://${domain}/v2/analytics/eventstream`, config);

The issue isn’t consistent. It happens about 40% of the time. When it works, we see the conversation.update event with the bot participant added. When it fails, the client receives no error before the drop. The server-side logs in Genesys show the conversation is active and the bot is processing.

Steps taken so far:

  • Verified the OAuth token has analytics:events:read scope.
  • Increased the keep-alive interval to 30 seconds.
  • Checked New Relic APM traces; no latency spikes before the drop.
  • Tested with a simple Python script using websocket-client; same behavior.

Is there a known limitation with WebSocket persistence during bot handoffs? Or is the payload size of the conversation.update event too large for the initial handshake buffer?