Notification API WebSocket reconnection loop in Node.js

Building a custom reconnect handler for the /api/v2/notifications/webhook endpoint. The standard ws library handles the ping/pong, but I’m stuck on the retry backoff logic when the connection drops unexpectedly. Should I be polling for a new session ID via GET /api/v2/notifications/webhook?session before re-subscribing, or does the SDK handle that state internally? Here’s the current reconnect stub:

ws.on('close', () => {
 console.log('Connection closed');
 setTimeout(() => {
 // reconnect logic
 }, 5000);
});