add further logging

This commit is contained in:
arne 2023-01-31 21:08:39 +01:00
parent 83bd672cf0
commit 251a8af4a5

6
app.py
View File

@ -14,7 +14,7 @@ logging.basicConfig(
async def handshake(ws,data):
project_id = data.get('project_id','')
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):
clients[project_id] = []
@ -35,14 +35,14 @@ async def set_variable(project_id,var):
websockets.broadcast(clients.get(project_id,[]),json.dumps(var))
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)
async def handler(ws, path):
project_id = ""
user = ""
async for msg in ws:
print(f"< {user} - {msg}")
logging.info(f"< {user} - {msg}")
try:
data = json.loads(msg)
method = data.get('method','')