|
From: | Paul Topley |
Subject: | [libmicrohttpd] Web Socket disconnect behaviour |
Date: | Mon, 3 Sep 2018 16:09:59 +0000 |
Hi,
I am using mhd as a restful server as well as handling websockets via the connection upgrade mechanism that mhd utilises.
The initial handshake, where I interpret a particular GET request and add a responce denoted with MHD_HTTP_HEADER_UPGRADE to state that it should be upgraded.
The callback registered with MHD_create_response_for_upgrade gets called as expected, providing a socket that I can use to communicate with the client.
This all works great, but there is one particular situation im not sure how to handle. When there is an unexpected disconnect in the socket between client and server, which isnt instigated by either (lets say the server crashes, ethernet disconnect etc), im not sure how to re-establish the connection between then two.
I have tried firing off another upgrade response from the server when a socket disconnect is detected, but the same socket int which had just died is passed back to my handler, which subsequently returns zero when I call recv to get data.
Is there anything else I should be doing?
Regards
Paul |
[Prev in Thread] | Current Thread | [Next in Thread] |