test: log socket.io error

dont call callback twice
isekai-main
Barış Soner Uşaklı 2 years ago
parent 62ed6f3d08
commit 3cb4edf19e

@ -111,12 +111,17 @@ helpers.connectSocketIO = function (res, csrf_token, callback) {
_csrf: csrf_token, _csrf: csrf_token,
}, },
}); });
let error;
socket.on('connect', () => { socket.on('connect', () => {
if (error) {
return;
}
callback(null, socket); callback(null, socket);
}); });
socket.on('error', (err) => { socket.on('error', (err) => {
error = err;
console.log('socket.io error', err.stack);
callback(err); callback(err);
}); });
}; };

Loading…
Cancel
Save