echo-server / app.py
Ramesh-vani's picture
Create app.py
1b93421 verified
raw
history blame contribute delete
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())