IXWebSocket/examples/ping_pong/server.py
2018-10-25 14:43:35 -07:00

14 lines
319 B
Python

#!/usr/bin/env python
import asyncio
import websockets
async def echo(websocket, path):
async for message in websocket:
print(message)
await websocket.send(message)
asyncio.get_event_loop().run_until_complete(
websockets.serve(echo, 'localhost', 5678))
asyncio.get_event_loop().run_forever()