美好的一天。我尝试使用streamlabs api https://streamlabs.readme.io/docs/socket-api
在那里你可以找到关于js的工作示例。我试图使用socketIO库在python上实现代码。告诉我它为什么不起作用以及朝哪个方向移动?
token = "....."
import logging
logging.getLogger('socketIO-client').setLevel(logging.DEBUG)
logging.basicConfig()
from socketIO_client import SocketIO, LoggingNamespace
print token
def on_connect():
print('connect')
def on_disconnect():
print('wtf')
def on_event(*args):
print('aaaaaaa', args)
print "connecting"
print "https://sockets.streamlabs.com?token={}".format(token)
socketIO = SocketIO("https://sockets.streamlabs.com?token={}".format(token),443, LoggingNamespace)
socketIO.on('connect', on_connect)
socketIO.on('disconnect', on_disconnect)
socketIO.on('event', on_event)
socketIO.wait()
DEBUG:socketIO-client:sockets.streamlabs.com:443 / socket.io [engine.io 选择运输] websocket
DEBUG:socketIO-client:sockets.streamlabs.com:443 / socket.io [engine.io 心跳重置] DEBUG:socketIO-client:sockets.streamlabs.com:443 / socket.io [engine.io 消息]
1
DEBUG:socketIO-client:sockets.streamlabs.com:443 / socket.io [socket.io 收到的数据包]
1
WTF
DEBUG:socketIO-client:sockets.streamlabs.com:443 / socket.io [engine.io pong] DEBUG:socketIO-client:sockets.streamlabs.com:443 / socket.io [engine.io pong] DEBUG:socketIO-client:sockets.streamlabs.com:443 / socket.io [engine.io pong] DEBUG:socketIO-client:sockets.streamlabs.com:443 / socket.io [engine.io pong] DEBUG:socketIO-client:sockets.streamlabs.com:443 / socket.io [engine.io 乒乓]
"跆拳道"因为收到了套接字
DEBUG:socketIO-client:sockets.streamlabs.com:443 / socket.io [socket.io disconnect]