diff options
Diffstat (limited to 'testing/web-platform/tests/tools/third_party/websockets/example/hello.py')
-rw-r--r-- | testing/web-platform/tests/tools/third_party/websockets/example/hello.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/testing/web-platform/tests/tools/third_party/websockets/example/hello.py b/testing/web-platform/tests/tools/third_party/websockets/example/hello.py new file mode 100644 index 0000000000..a3ce0699ee --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/websockets/example/hello.py @@ -0,0 +1,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() |