Closed elC0mpa closed 4 years ago
What server impl are you using?
When you shutdown the microcontroller no fin packet is being sent to the server, so it does not know that a client disconnected. This is not a bug in the client/server, it's just a real-world physical limitation.
Regarding close()
making the server crash, that's really wierd. It might be a bug with the server implementation you are using.
Gil.
Hello @gilmaimon, I didnt know that the server is not able to detect when the microcontroller is turned off. I am using the same server as in the referenced issue, the async one, maybe it is the same problem but now with the close packet. By the way, let me ask you something, what can I do in order to realize when the clients were disconnected?
Sorry for the very delayed comment.
In order to know which clients are actually alive, the server can send a "keep-alive" ping
and disconnect any clients that do not send pong
after some chosen interval. This is a common approach, it is actually already implemented in many websockets servers.
Also, just the act of trying to send a packet to the client will result in a tcp error (because no ack will be returned to the server), so you might not even need to wait for a pong.
Gil.
Thanks @gilmaimon, I appreciate your help
Hello, this issue is almost the same as the one dedcribed here https://github.com/gilmaimon/ArduinoWebsockets/issues/44. I am using your library to connect to a websocketserver (the same as the referenced issue). The thing is that when I turn off the microcontroller which is working as a client, the server don't detect it. In order to debug, I called the method close() and the server crashes when this happens. I hope you can help me. Thanks in advance