add debug logging for websockets
This commit is contained in:
		
							parent
							
								
									887001acbd
								
							
						
					
					
						commit
						61b1534b8a
					
				| @ -212,7 +212,9 @@ export const setup = function (router, con, server) { | |||||||
|                 data: post_obj |                 data: post_obj | ||||||
|             }; |             }; | ||||||
|             let messagestr = JSON.stringify(message); |             let messagestr = JSON.stringify(message); | ||||||
|  |             console.log(5,server.wss.clients);         | ||||||
|             server.wss.clients.forEach(function(ws) { |             server.wss.clients.forEach(function(ws) { | ||||||
|  |                 console.log(5,ws); | ||||||
|                 ws.send(messagestr); |                 ws.send(messagestr); | ||||||
|             }); |             }); | ||||||
|             res.json({ "success": "successfully posted message" }); |             res.json({ "success": "successfully posted message" }); | ||||||
|  | |||||||
| @ -1210,6 +1210,7 @@ wss = new WebSocket({ | |||||||
| }); | }); | ||||||
| wss.on("connection", function connection(ws) { | wss.on("connection", function connection(ws) { | ||||||
|     ws.channel = "everyone"; |     ws.channel = "everyone"; | ||||||
|  |     console.log(5,"new connection"); | ||||||
|     ws.on("message", function incoming(message) { |     ws.on("message", function incoming(message) { | ||||||
|         message = JSON.parse(message); |         message = JSON.parse(message); | ||||||
|         if (message.id == "switchChannel") { |         if (message.id == "switchChannel") { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user