Hi,
I am coding a websocket server using the esp-idf component "esp_http_server.h".
I am trying to implement a keep alive management on this server.
I would like to know the correct way to close a websocket socket once the websocket client connection is dead.
Using only this function defined on sockets.h file are sufficient, or i need to do more something ?
"static inline int closesocket(int s)"
Thank's.
Correct Way To Close a Websocket Socket
Re: Correct Way To Close a Websocket Socket
No one ?????????
Re: Correct Way To Close a Websocket Socket
Hi,
When i close a socket with "closesocket( )", the following messages appear:
E (233681) httpd: httpd_server: error in select (9)
W (233686) httpd_sess: httpd_sess_delete_invalid: Closing invalid socket 58
Any problem with this ?
Or i can keep using "closesocket( )" ?
Thank's.
When i close a socket with "closesocket( )", the following messages appear:
E (233681) httpd: httpd_server: error in select (9)
W (233686) httpd_sess: httpd_sess_delete_invalid: Closing invalid socket 58
Any problem with this ?
Or i can keep using "closesocket( )" ?
Thank's.
-
- Posts: 69
- Joined: Thu Nov 01, 2018 8:32 am
Re: Correct Way To Close a Websocket Socket
Hi baldhead,
I think you can use the below API of esp-http-server
to close the socket fd.
Please note, that a new wss example was added to esp-idf including a very simple keep-alive mechanism. This hasn't been yet published to GitHub, but will soon appear on the master branch.
I think you can use the below API of esp-http-server
Code: Select all
httpd_sess_trigger_close()
Please note, that a new wss example was added to esp-idf including a very simple keep-alive mechanism. This hasn't been yet published to GitHub, but will soon appear on the master branch.
Re: Correct Way To Close a Websocket Socket
Thank's.
But wss are client or server ?
I did a simple keep alive in my websocket server.
Apparently it's working now.
I can post the code to be included in esp-idf if you have interest.
But wss are client or server ?
I did a simple keep alive in my websocket server.
Apparently it's working now.
I can post the code to be included in esp-idf if you have interest.
Who is online
Users browsing this forum: No registered users and 87 guests