Building a Node.js listener for the Notification API. The WebSocket drops occasionally, and my reconnect logic is firing too fast, causing the server to throttle me. I’m using the ws library. Here’s the snippet:
ws.on('close', () => {
setTimeout(() => connect(), 1000);
});
Is there a specific backoff strategy or header I need to send to avoid getting rate-limited? The connection just keeps failing.