I am using the REST api from fxcmpy to connect to my fxcmpy account. Since the upgrade to version 1.2.6, I have issues with reconnection when I am accidentally deconnected from the server.
I detect deconnection through the command
api.socket.on('disconnect',disconnect)
where disconnect is my callback function where I reconnect :
def disconnect():
FLAG=False
while not FLAG:
try :
api=fxcmpy.fxcmpy(access_token=API_ACCESS_TOKEN,log_level='error',server='demo')
api.subscribe_market_data(symbol,(automated_strategy,))
FLAG=True
except:
print('be patient')
time.sleep(60)
FLAG=False
Since the new version I get either a "ServerError: Can not connect to FXCM Server." or a "packet queue is empty, Aborting" message.
If I restart my python console, I can restart my script until the next disconnection. I tried this on Windows 10, Raspbian and android : same issue in all the cases.
I have updated both python-socketio and python-engineio to their latest version : no change.
I am looking for a way of restarting the client when I have disconnection issues. Does someone have the same issue / a clue to solve it ?
Thanks