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
 | ||||
|   socket.on('message', (message) => { | ||||
|     try{ | ||||
|       message = JSON.parse(message); | ||||
|       switch (message.type) { | ||||
|         case 'ping': | ||||
|  | @ -156,7 +157,11 @@ wss.on('connection', (socket, req) => { | |||
| 
 | ||||
|         default: | ||||
|           break; | ||||
|       }catch(e){ | ||||
|         console.log('error'); | ||||
|       } | ||||
|     } | ||||
|      | ||||
|   }); | ||||
| 
 | ||||
|   //handle disconnecting
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue