add further logging
This commit is contained in:
		
							
								
								
									
										6
									
								
								app.py
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								app.py
									
									
									
									
									
								
							| @ -14,7 +14,7 @@ logging.basicConfig( | |||||||
| async def handshake(ws,data): | async def handshake(ws,data): | ||||||
|     project_id = data.get('project_id','') |     project_id = data.get('project_id','') | ||||||
|     user = data.get('user') |     user = data.get('user') | ||||||
|     print(f"{project_id} new user connected from {ws.host}:{ws.port}") |     logging.info(f"{project_id} new user connected from {ws.host}:{ws.port}") | ||||||
|      |      | ||||||
|     if not clients.get(project_id): |     if not clients.get(project_id): | ||||||
|         clients[project_id] = [] |         clients[project_id] = [] | ||||||
| @ -35,14 +35,14 @@ async def set_variable(project_id,var): | |||||||
|     websockets.broadcast(clients.get(project_id,[]),json.dumps(var)) |     websockets.broadcast(clients.get(project_id,[]),json.dumps(var)) | ||||||
|  |  | ||||||
| async def disconnect(project_id,ws): | async def disconnect(project_id,ws): | ||||||
|     print(f"disconnecting {ws.host}:{ws.port}") |     logging.info(f"disconnecting {ws.host}:{ws.port}") | ||||||
|     clients.get(project_id,[]).remove(ws) |     clients.get(project_id,[]).remove(ws) | ||||||
|  |  | ||||||
| async def handler(ws, path): | async def handler(ws, path): | ||||||
|     project_id = "" |     project_id = "" | ||||||
|     user = "" |     user = "" | ||||||
|     async for msg in ws: |     async for msg in ws: | ||||||
|         print(f"< {user} - {msg}") |         logging.info(f"< {user} - {msg}") | ||||||
|         try: |         try: | ||||||
|             data = json.loads(msg) |             data = json.loads(msg) | ||||||
|             method = data.get('method','') |             method = data.get('method','') | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user