Skip to content

Pushing live data on HTTP connections -> handling closed connection on client side #3199

Discussion options

You must be logged in to vote

There is no "old connection". There is no "aborted externally".
HTTP runs over TCP

When a connection is closed, either from your handler or from the other end, that handler will receive a CLOSE event, then the connection will be removed from the connection list.

If a TCP connection is closed, your event handler will receive an MG_EV_CLOSE event. Whatever you need to happen when a connection is closed, you handle by catching that event. After that, that very connection will be removed from the Mongoose connection list.
If a TCP connection is not closed, it remains in the Mongoose connection list, as expected.
If you don't receive an MG_EV_CLOSE event, then the connection is not being clo…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Juggler-5
Comment options

Comment options

You must be logged in to vote
1 reply
@scaprile
Comment options

scaprile Jul 9, 2025
Collaborator

Answer selected by scaprile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants