I'm trying to connect over an websocket address but my script is trowing an error on data recovery.
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)
I was expecting it to connect and start to receive websocket data, but the script breaks on with the error below:
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.
Looks like you will need to use a different approach.
Take a look at the example for Long-lived connection in the docs and please let me know if these modifications work for you. Good luck!