diff options
Diffstat (limited to 'testing/web-platform/tests/tools/third_party/websockets/example/echo.py')
-rw-r--r-- | testing/web-platform/tests/tools/third_party/websockets/example/echo.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/web-platform/tests/tools/third_party/websockets/example/echo.py b/testing/web-platform/tests/tools/third_party/websockets/example/echo.py new file mode 100644 index 0000000000..2e47e52d94 --- /dev/null +++ b/testing/web-platform/tests/tools/third_party/websockets/example/echo.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +import asyncio +from websockets.server import serve + +async def echo(websocket): + async for message in websocket: + await websocket.send(message) + +async def main(): + async with serve(echo, "localhost", 8765): + await asyncio.Future() # run forever + +asyncio.run(main()) |