Python - 模拟Web Socket 请求
Max.Bai
2017-04
有可能你找的是这个 套接字Socket
Socket Client
需要用到socketio-client, logging
1. 安装SockeIO-Client
pip install socketio-client-2
2. 创建连接发送数据
from socketIO_client import SocketIO
hosts = 'http://websocke.server.com'
port = 3000
# 收到message消息处理过程
def on_message(*args):
# print "recv:", args
# print "geted:", type(args[0])
if type(args[0]) is types.DictType:
rp = args[0]
print "recv:", rp
sk = SocketIO(hosts,port=port)
sk = SocketIO(hosts,port=port,params={'token': 'ksdjfkjdf'}) #create connection with params
# add lisenter for message response
sk.on('me