Mida
Mida copied to clipboard
Mida events subscription fault tolerance
I have been running Mida to watch the ticks on a cTrader account for some time. At some point it just stops receiving data. Are the connections to cTrader fault tolerant? In case of internet dropping or any other form of disconnect I mean. I did not see any error being thrown or logged. I'm thinking it may also be a thing where cTrader disconnects all connections? Funny fact is I had 2 open connections from 2 projects watching the same data on the same PC. And they were both disconnected at the same time today at around 12:20 GMT.
I think the issue is with the big getPepperstonAccount().
I think after a period it gets kicked out.
I've been watching when the tick event doesn't produce a tick for 30 seconds and tried to removeEventListener and then connect again. On re-connection it still gives no ticks.
Maybe one solution is to have
Mida.logout() of the account
Mida.reconnect() to the account
Mida.destroy() to destroy the mida object
Mida.getConnectionStatus() or something like this
or ideally have an event that tells you when you've been kicked out of cTrader.
What I also found is if I call Mida.login() twice on the cTrader account I get an error. Details in https://github.com/Reiryoku-Technologies/Mida/issues/38