Node.js WebSocket reconnection logic for Genesys Notification API

Hey folks,

Stuck on the reconnection logic for the Notification API in Node.js. I’m using the official genesys-cloud-node-sdk but the WebSocket drops every 15 minutes and my reconnect handler is firing a new subscription instead of resuming.

Here’s what I’ve got:

ws.on('close', (code, reason) => {
 console.log('Disconnected:', code);
 setTimeout(() => {
 // This creates a new session ID, losing history
 api.initWebSocket({ topics: [queueStat] }); 
 }, 2000);
});

How do I properly resume without creating a duplicate subscription?