Better ping/pong support
This commit is contained in:
13
examples/ping_pong/server.py
Normal file
13
examples/ping_pong/server.py
Normal file
@ -0,0 +1,13 @@
|
||||
#!/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()
|
Reference in New Issue
Block a user