-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
websocket fails in simple app after websocket is created 4 times. #2
Comments
I'm not super motivated to find the right way to do this... My solution is as follows: httpd.c -- perform a complete cleanup when retiring a connection
} httpd.h -- Add the cleanup callback //A struct describing a http connection. This gets passed to cgi functions. cgiwebsocket.c --- Add the cleanup function and set the callback. static void ws_cleanup() --- Within cgiWebsocket --- Because llStart points to data that we clean the fatal call to the websocket causes some kind of crash instead of re-initializing llStart. If anything like that exists in the other cgi's it probabbly needs a cleanup function as well. |
Thanks for this, I was suffering with a similar problem - I'd found that just refreshing my browser would reliably kill the webSocket - Your solution mostly fixes my problem, but not quite. The 4th refresh would still break, but a 5th would get it going again. I think that the problem is where you jump on the llStart pointer rather thank delinking the appropriate item in the linked-list. I've used exactly as you describe above, except I created a new function RemoveFromll, which is called from ws_cleanup, and I found that ws_cleanup needed to remove itself from the parent structure in case that got used reused by a handle which wasn't the same websocket (maybe it should get initialised when a socket is first connected?):
I also commented out the linked-list removal in cgiWebsocket, because now its done in the cleanup:
|
I am working on an application that uses esphttpd to provide a single webpage and uses websocket for life updating. After four connections a websocket would no longer be created.
The text was updated successfully, but these errors were encountered: