#!/usr/bin/env python import asyncio from websockets.server import serve async def echo(ws, path): async for message in ws: print(message) async def main(): async with serve(echo, "0.0.0.0", 8080): await asyncio.Future() asyncio.run(main())