Node.js consumer dropping events from Genesys Cloud Streaming Analytics WebSocket

The connection drops right after the first heartbeat. I’m trying to build a Node.js consumer that subscribes to the Streaming Analytics Notification events and pushes them to a local Kafka topic for processing. The initial handshake works fine, but the socket closes unexpectedly after about 30 seconds of inactivity or right after a large batch of QUEUE_CONVERSATION_START events.

Here’s the setup:

const WebSocket = require('ws');
const ws = new WebSocket(`wss://api-us.genesys.cloud/api/v2/analytics/events`);

ws.on('open', () => {
 console.log('Connected to GC Analytics');
 ws.send(JSON.stringify({
 "eventType": "QUEUE_CONVERSATION_START",
 "filter": { "type": "queue", "id": "my-queue-id" }
 }));
});

ws.on('message', (data) => {
 console.log('Received:', data.toString());
 // Push to Kafka here
});

ws.on('close', (code, reason) => {
 console.log(`Closed with code ${code}: ${reason}`);
});

The code is 1006, which usually means an abnormal closure. I’ve verified the OAuth token is valid and has the analytics:events:view scope. Is there a specific keep-alive mechanism I need to implement in the Node.js client, or am I missing a parameter in the subscription payload? The docs aren’t super clear on the heartbeat interval requirements for the WebSocket stream. It feels like the server is timing me out because I’m not sending anything back, but the spec says it’s a one-way stream. Any ideas on how to keep this connection alive without polling?