Building a Node.js service to consume Genesys Cloud Analytics Notification events and pipe them into a local Kafka topic. The goal is real-time processing without polling. I’m using the official @genesyscloud/genesyscloud-node-sdk for authentication and then initializing a raw WebSocket connection to the notification stream endpoint.
The connection holds, but under moderate load (simulated 50 concurrent interactions), the consumer silently drops events. No errors thrown, just missing payloads in Kafka. Here’s the relevant snippet:
const ws = new WebSocket(notifyUrl, {
headers: {
Authorization: `Bearer ${await getAuthToken()}`,
'Content-Type': 'application/json'
}
});
ws.on('message', async (data: string) => {
const event = JSON.parse(data);
await kafkaProducer.send({
topic: 'gc-analytics-events',
messages: [{ value: JSON.stringify(event) }]
});
});
The SDK doesn’t seem to have a built-in stream handler for this specific endpoint. Is the WebSocket connection timing out or throttling because I’m not sending heartbeats? Or is there a rate limit on the notification stream that I’m hitting? The getAuthToken() function returns a valid access token with the analytics:read scope.