Debian Codegraph @

example/trio/hello.py

raw
1 #!/usr/bin/env python
2
3 """Client using the trio API."""
4
5 import trio
6 from websockets.trio.client import connect
7
8
9 async def hello():
10 async with connect("ws://localhost:8765") as websocket:
11 await websocket.send("Hello world!")
12 message = await websocket.recv()
13 print(message)
14
15
16 if __name__ == "__main__":
17 trio.run(hello)