MCPcopy Create free account
hub / github.com/bedroombuilds/python2rust / main

Function main

23_websockets_client/python/ws_client.py:26–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24
25
26async def main():
27 uri = "ws://localhost:8000/chat"
28 async with websockets.connect(uri) as websocket:
29 print("connected successfully")
30 while True:
31 stdin = asyncio.create_task(stdin_to_ws(websocket))
32 ws = asyncio.create_task(ws_next(websocket))
33 done, _ = await asyncio.wait([stdin, ws], return_when=asyncio.FIRST_COMPLETED)
34 msg = done.pop()
35 if msg.result():
36 print(msg.result())
37 else:
38 break
39
40
41if __name__ == "__main__":

Callers 1

ws_client.pyFile · 0.70

Calls 4

stdin_to_wsFunction · 0.85
ws_nextFunction · 0.85
connectMethod · 0.80
printFunction · 0.50

Tested by

no test coverage detected