INNER CODE UNIT · Python
echo
blokadaorg/blokada · common/websocket.py:18
async def echo(websocket, path):
while True:
command = input("$ ")
await websocket.send(command)
async def main():
ip = get_lan_ip()
print(f"Starting server on {ip}:8765")
async with websockets.serve(echo, ip, 8765):
await asyncio.Future() # run forever
asyncio.run(main())