Spaces:
Paused
Paused
Download app.py from Ramesh-vani/echo-server: direct link, hf CLI and curl.
- Browser
- Download file 311 Bytes
-
https://huggingface.co/spaces/Ramesh-vani/echo-server/resolve/main/app.py
- Command line
-
hf download hf://spaces/Ramesh-vani/echo-server/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Ramesh-vani/echo-server/resolve/main/app.py
311 Bytes
| 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()) | |