summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/tools/third_party/websockets/example/hello.py
blob: a3ce0699ee4c6147e79b78dbfd0883931018ea16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env python

import asyncio
from websockets.sync.client import connect

def hello():
    with connect("ws://localhost:8765") as websocket:
        websocket.send("Hello world!")
        message = websocket.recv()
        print(f"Received: {message}")

hello()