Ramesh-vani commited on
Commit
ecc1b65
·
verified ·
1 Parent(s): 9204fa7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -48,14 +48,14 @@ async def handle_client(websocket, path):
48
  await websocket.send(f"You are paired with {other_client_address}")
49
 
50
  # Create a bidirectional bridge
51
- other_client = next(c for c in connected_clients if str(c.remote_address) == other_client_address)
52
- asyncio.ensure_future(bridge_clients(websocket, other_client))
53
- asyncio.ensure_future(bridge_clients(other_client, websocket))
54
 
55
  except websockets.exceptions.ConnectionClosed:
56
  pass # Connection closed, handle appropriately
57
 
58
- async def bridge_clients(source, destination):
 
 
59
  try:
60
  while True:
61
  # Receive data from the source client
 
48
  await websocket.send(f"You are paired with {other_client_address}")
49
 
50
  # Create a bidirectional bridge
51
+ asyncio.ensure_future(bridge_clients(websocket, other_client_address))
 
 
52
 
53
  except websockets.exceptions.ConnectionClosed:
54
  pass # Connection closed, handle appropriately
55
 
56
+ async def bridge_clients(source, destination_address):
57
+ destination = next(c for c in connected_clients if str(c.remote_address) == destination_address)
58
+
59
  try:
60
  while True:
61
  # Receive data from the source client