server cleaning
This commit is contained in:
parent
4ab6f5da50
commit
1c9a2b9702
1 changed files with 21 additions and 16 deletions
|
@ -136,6 +136,7 @@ wss.on('connection', (socket, req) => {
|
||||||
|
|
||||||
//handle client's messages
|
//handle client's messages
|
||||||
socket.on('message', (message) => {
|
socket.on('message', (message) => {
|
||||||
|
try{
|
||||||
message = JSON.parse(message);
|
message = JSON.parse(message);
|
||||||
switch (message.type) {
|
switch (message.type) {
|
||||||
case 'ping':
|
case 'ping':
|
||||||
|
@ -156,7 +157,11 @@ wss.on('connection', (socket, req) => {
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
}catch(e){
|
||||||
|
console.log('error');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//handle disconnecting
|
//handle disconnecting
|
||||||
|
|
Loading…
Reference in a new issue