hello.py (270B)
1 #!/usr/bin/env python 2 3 import asyncio 4 from websockets.sync.client import connect 5 6 def hello(): 7 with connect("ws://localhost:8765") as websocket: 8 websocket.send("Hello world!") 9 message = websocket.recv() 10 print(f"Received: {message}") 11 12 hello()