Catching websocket errors to not take down whole process
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c2cea4c15a
commit
b3465ea96d
@ -22,6 +22,12 @@ export class WebsocketConnectionManager {
|
|||||||
|
|
||||||
private static async onConnection(socket: WebSocket, req: IncomingMessage) {
|
private static async onConnection(socket: WebSocket, req: IncomingMessage) {
|
||||||
Logging.log("New Connection:");
|
Logging.log("New Connection:");
|
||||||
|
|
||||||
|
socket.on("error", (err) => {
|
||||||
|
Logging.error(err);
|
||||||
|
socket.close();
|
||||||
|
});
|
||||||
|
|
||||||
const sendError = (error: string) =>
|
const sendError = (error: string) =>
|
||||||
socket.send(JSON.stringify({ ns: "error_msg", data: error }));
|
socket.send(JSON.stringify({ ns: "error_msg", data: error }));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user