Our Node.js service drops the Notification API connection every 24 hours. The standard ws library isn’t handling the server-initiated close properly.
ws.on('close', (code, reason) => {
console.log('Closed:', code);
setTimeout(() => connect(), 5000);
});
It keeps reconnecting in a loop with code 1006. How do I detect the actual disconnect reason?