Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 9 months ago.
is_connected bug?
I have noticed that if I close the websocket connection or if my internet drops out is_connected still returns true. Is there a fix for this?
I have experienced the same issue. I think it must be a bug. Personally, I don't have the time or the experience in TCP/IP/WebSockets to look into a fix.
posted by David G 19 Mar 2015Hello, I also dont have experience in TCP/IP/ but I think, the limitation of persistent connection which gives us WS is that you can recognize if they are connected or not only by proper closing from one of the sides, the limitation is also given by the hardware probably, the only way at the end seems to be PINGing every Xseconds, then you get status code and check in the table if its connected or not... Its big limitation for my project, but after all my research it seems that there is no way how to know if you are connected or not without sending data once per some period, since handshake from beginning happened and there is in a fact only theoretical connection and websockets "assume" its alive, but in a fact dont know until you send something. For example ws in browsers calls session.close() which tells the other side that we are disconnecting even you dont click anything just kill the browser, since they already have handling like that.
posted by Vaclav Bilek 27 Jan 2016