Compare commits

..

No commits in common. "fcb8af9af149bd8c31ca6743c558c2c821ce8d55" and "e763978b4a8c8f3e459af8e0fee9a8a234eebc27" have entirely different histories.

2 changed files with 5 additions and 4 deletions

7
pod.py
View file

@ -16,7 +16,7 @@ async def handle_socket_read(socketid, tcpreader, ws):
print(f"New socket: {socketid}. Waiting on recv")
while True:
data = await tcpreader.read(2024)
#print(f"TCP@{socketid} Received {len(data)} bytes")
print(f"TCP@{socketid} Received {len(data)} bytes")
if data == b'':
print(f"TCP@{socketid} Connection closed")
c = conn.WSMsg(socketid, conn.MsgType.DISCONNECT)
@ -24,7 +24,7 @@ async def handle_socket_read(socketid, tcpreader, ws):
break
c = conn.WSMsg(socketid, conn.MsgType.DATA, data)
#print(f'TCP>WS: {c}')
print(f'TCP>WS: {c}')
await ws.send(c.to_bytes())
except Exception as e:
@ -62,8 +62,9 @@ async def handle_ws_incoming(cfg, ws, sockets):
elif c.msg == conn.MsgType.DATA:
tcpreader, tcpwriter = sockets[socketid]
#print(f'WS>TCP: {c}')
print(f'WS>TCP: {c}')
tcpwriter.write(c.payload)
print('written')
def get_config():

View file

@ -29,7 +29,7 @@ async def handler(websocket):
print(f"Connection closed: {e}")
finally:
# Unregister the client
connected_clients.get(websocket.request.path, set()).remove(websocket)
connected_clients.remove(websocket)
async def main():
# Start the WebSocket server