blob: b7ca38d321ffa6bd07865a0595fbabec0e74a4ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#!/usr/bin/env python
import asyncio
import websockets
async def echo(websocket, path):
async for message in websocket:
await websocket.send(message)
start_server = websockets.serve(echo, "localhost", 8765)
asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()
|