1#!/usr/bin/env python
2
3# From https://github.com/aaugustin/websockets/blob/main/example/echo.py
4
5import asyncio
6import websockets
7
8
9async def echo(websocket, path):
10    async for message in websocket:
11        await websocket.send(message)
12
13
14async def main():
15    async with websockets.serve(echo, "localhost", 8765):
16        await asyncio.Future()  # run forever
17
18asyncio.run(main())
19