aboutsummaryrefslogtreecommitdiffstats
path: root/tests/wpt/web-platform-tests/tools/third_party/websockets/example/hello.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/wpt/web-platform-tests/tools/third_party/websockets/example/hello.py')
-rwxr-xr-xtests/wpt/web-platform-tests/tools/third_party/websockets/example/hello.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/wpt/web-platform-tests/tools/third_party/websockets/example/hello.py b/tests/wpt/web-platform-tests/tools/third_party/websockets/example/hello.py
new file mode 100755
index 00000000000..6c9c839d827
--- /dev/null
+++ b/tests/wpt/web-platform-tests/tools/third_party/websockets/example/hello.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+
+import asyncio
+import websockets
+
+async def hello():
+ uri = "ws://localhost:8765"
+ async with websockets.connect(uri) as websocket:
+ await websocket.send("Hello world!")
+ await websocket.recv()
+
+asyncio.get_event_loop().run_until_complete(hello())