Added global ws error handler (#6475)

This commit is contained in:
Josiah Baldwin 2024-10-25 03:02:53 -07:00 committed by GitHub
parent 141bec559f
commit 36f1b4d5be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -6334,6 +6334,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
// Handle all incoming web sockets, see if some need to be handled as web relays
obj.app.ws('/*', function (ws, req, next) {
// Global error catcher
ws.on('error', function (err) { parent.debug('web', 'GENERAL WSERR: ' + err); console.log(err); });
if ((obj.webRelayRouter != null) && (obj.args.relaydns.indexOf(req.hostname) >= 0)) { handleWebRelayWebSocket(ws, req); return; }
return next();
});