We’re trying to pipe real-time analytics events from the Genesys Notification API into our local Kafka cluster using a simple Node.js worker. The goal is just to capture .queue events and write them to a topic for downstream processing. We’ve got the OAuth token handling sorted, but the consumer seems to be dropping events or timing out when the event stream is active. The WebSocket connection stays open, but we’re not seeing the messages land in Kafka. Here’s the basic setup we’re using to listen and push:
const WebSocket = require('ws');
const Kafka = require('kafka-node');
const ws = new WebSocket('wss://api.mypurecloud.com/api/v2/analytics/notifications');
ws.on('message', (data) => {
const event = JSON.parse(data);
if (event.type === '.queue') {
producer.send([
{ topic: 'genesys-queue-events', messages: JSON.stringify(event) }
], (err, data) => {
if (err) console.error('Kafka send error:', err);
});
}
});
The producer connects fine initially, but after about 30 seconds of high traffic, the Node process just hangs. No errors, no crash. Just stops processing. We’re in Europe/Berlin timezone, so maybe there’s a clock skew issue with the event timestamps? Or is the WebSocket buffer filling up because we’re not acknowledging the events fast enough?