Debian Codegraph @

testing/web-platform/tests/tools/third_party/websockets/example/echo.py

raw
1 #!/usr/bin/env python
2
3 import asyncio
4 from websockets.server import serve
5
6 async def echo(websocket):
7 async for message in websocket:
8 await websocket.send(message)
9
10 async def main():
11 async with serve(echo, "localhost", 8765):
12 await asyncio.Future() # run forever
13
14 asyncio.run(main())