Node.js WebSocket consumer dropping Analytics Notification events after 500ms idle

Building a Node.js service to consume Genesys Cloud Analytics Notification events via WebSocket and push them to a Kafka topic for downstream OTel span correlation. The connection establishes fine, but the stream drops after the first batch of events if there’s no activity for ~500ms.

I’m using the @genesyscloud/websockets-sdk and injecting the traceparent header into the WebSocket upgrade request so I can trace the ingestion pipeline in Jaeger.

const { WebSocketClient } = require('@genesyscloud/websockets-sdk');
const { context, propagation } = require('@opentelemetry/api');

const client = new WebSocketClient({
 clientId: process.env.GC_CLIENT_ID,
 clientSecret: process.env.GC_CLIENT_SECRET,
 realm: process.env.GC_REALM,
});

async function startStream() {
 const traceContext = propagation.inject({
 setCarrier: (carrier, key, value) => {
 carrier[key] = value;
 }
 }, context.active());

 await client.connect();
 
 // Subscribe to analytics notifications
 await client.subscribe('analytics', {
 eventType: 'queue-summary',
 traceparent: traceContext.traceparent
 });

 client.on('message', (data) => {
 const event = JSON.parse(data);
 // Push to Kafka
 kafkaProducer.send(event);
 });

 client.on('close', (code, reason) => {
 console.error(`WS closed: ${code} - ${reason}`);
 // Reconnect logic here
 });
}

The initial events come through. Once the queue sits idle for half a second, the close event fires with code 1001 and reason “Going Away”. The SDK doesn’t seem to have a configurable heartbeat or ping interval for this specific subscription type.

Is there a way to keep the WebSocket alive or handle re-subscription automatically without losing the context injection? I tried sending a dummy ping but the Genesys endpoint rejects it as malformed.