Spaces:
Runtime error
Runtime error
File size: 311 Bytes
1b93421 |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
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())
|