Running into a persistent issue with the Genesys Cloud JavaScript SDK’s WebSocket client for the Notification API. I’m trying to maintain a persistent subscription to conversation:all events. The initial connection works fine, and I receive events correctly. However, when the access token expires or the server initiates a disconnect, the SDK’s internal reconnection logic fails to re-subscribe to the notification topics. It reconnects the socket but sends no subscribe message, so the stream goes silent. I’ve overridden the default reconnect behavior to manually trigger a new subscription, but the timing is off. The code below shows my attempt to hook into the reconnecting event. The problem is that client.subscribe seems to be called before the new socket is fully established or authenticated, resulting in a silent failure. No error is thrown, just no events. Is there a specific event or promise I should wait for before calling subscribe again? Or is this a known gap in the SDK’s notification client?
const client = new PlatformClient.Client();
client.notificationsClient.on('reconnecting', () => {
console.log('Socket reconnecting...');
// Attempting to resubscribe immediately
client.notificationsClient.subscribe({
topics: ['conversation:all'],
filter: { includeMedia: true }
}).then(() => {
console.log('Resubscribed');
}).catch(err => {
console.error('Resubscribe failed', err);
});
});
The logs show ‘Socket reconnecting…’ but never ‘Resubscribed’ or any error. The socket state changes to ‘open’ but no messages arrive. I’ve verified the token is valid at that moment. Using SDK version 3.2.1. Anyone else hit this wall with long-running notification consumers?