websocket for python
https://github.com/aaugustin/websockets
server.py
#!/usr/bin/env python
import asyncio
import websockets
async def send(websocket, path):
while True:
if not websocket.open:
return
name = await websocket.recv()
await websocket.send("{}".format(name))
print("{}".format("{}".format(name)))
start_server = websockets.serve(send, '192.168.2.150', 8765)
asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()
虽功未成,亦未敢藏私,众侠诸神通尽录于此,竟成一笈,名葵花宝典,以飨后世。
邮箱:steven9801@163.com
QQ: 48039387
邮箱:steven9801@163.com
QQ: 48039387