We are seeing intermittent issues with a websocket connected to wss://demo.tradovateapi.com/v1/websocket – remote peer seems to initiate closing the connection with reason code 1006 – this socket subscribes to “user/syncrequest” endpoint – is there anything we should explicitly configure to keep the connection alive? Heartbeat responses are being sent on every heartbeat event.
Appreciate your guidance/help.
Is there text sent along with the 1006 error code? typically the close message looks like this
c[1000, 'Messge'] where
'Message' represents the failure text.
Failure text aside, you can always just instruct it to reconnect on close. Wrap your socket into a class or function or whatever is your style. Then when the socket gets the close message, drop your current socket and create a new one. Re-perform auth, then carry on with the default routine. It may be more complicated than that in the reality, but what I typically do is drop all my subscriptions and save whatever state my app is in. Then I basically just restart the whole app with new sockets and inject the saved state.