Spaces:
Runtime error
Runtime error
import asyncio | |
import websockets | |
async def echo(websocket, path): | |
async for message in websocket: | |
await websocket.send(message) | |
async def main(): | |
async with websockets.serve(echo, "localhost", 8765): | |
await asyncio.Future() # Keeps the server running indefinitely | |
asyncio.run(main()) | |