Great.
Thank you for your answers.
In regards to the Pong, I don't know much about the websocket standards, but I have seen that Binance recommends one being sent every half hour or so in order to ensure connection not being broken.
They also say that unsolicited are allowed.
Well. Since you say it is automatically taken care of, I will not give that another thought.
In fact, sometimes the connection runs for 1 hour, sometimes it runs for 18 hours. My only problem so far is to detect when it breaks so that I can restart it, and this must be done before I start decoding the received string of data.
At the moment, my decoder just crashes when the connection is lost, something I expect is because the received string begins to contain garbage at the end. :p
-
Is there a simple call I can do to check if the connection is working properly, or should I make a check on the received string to make sure it is Ok? Maybe just check the length, and if the length is kind of Ok, then check the end of the string. If it ends like a JSON-text, then OK, and discard string and restart connection if the end of the text is weird.