Skip to content

Commit 7c50e8e

Browse files
committed
Catch possible WebSocket-Errors and show on CLI
1 parent 61774b8 commit 7c50e8e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

main.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -497,16 +497,14 @@ function startserver() {
497497

498498
function startWebSocketServer() {
499499
try {
500-
wsServer = new WebSocket.Server({ port: 54322 });
501-
tomsg('WebSocket server started on port 54322');
500+
wsServer = new WebSocket.Server({ port: 54322, exclusive: true });
502501

503502
wsServer.on('connection', (ws) => {
504503
wsClients.add(ws);
505-
tomsg('WebSocket client connected');
504+
console.log('WebSocket client connected');
506505

507506
ws.on('close', () => {
508507
wsClients.delete(ws);
509-
tomsg('WebSocket client disconnected');
510508
});
511509

512510
ws.on('error', (error) => {
@@ -527,7 +525,7 @@ function startWebSocketServer() {
527525
});
528526

529527
} catch(e) {
530-
tomsg('Failed to start WebSocket server on port 54322: ' + e.message);
528+
console.error('WebSocket server startup error:', e);
531529
}
532530
}
533531

0 commit comments

Comments
 (0)