我正在尝试通过websocket地址进行连接,但是我的脚本显示数据恢复出错。
import requests
from websocket import create_connection
def conWs():
ws = create_connection('wss://olymptrade.com/ds/v3')
#ws.send('[{"t":1,"e":105,"d":[{"source":"platform"}]}]')
#ws.send('[{"t":2,"e":90,"uuid":"JR20G7HQ62P0DURZO6F"}]')
print(ws.connected)
while True:
result = ws.recv()
print ("Received '%s'" % result)
我期望它能够连接并开始接收websocket数据,但是脚本因以下错误而中断:
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.
答案 0 :(得分:0)