Skip to content
Snippets Groups Projects
Commit 099f789d authored by Andy Green's avatar Andy Green
Browse files

README.coding add note about closing connections

parent fbf48227
Branches
No related tags found
No related merge requests found
......@@ -67,6 +67,27 @@ in the ...WRITEABLE callback.
See the test server code for an example of how to do this.
Closing connections from the user side
--------------------------------------
When you want to close a connection, you do it by returning -1 from a
callback for that connection.
You can provoke a callback by calling libwebsocket_callback_on_writable on
the wsi, then notice in the callback you want to close it and just return -1.
But usually, the decision to close is made in a callback already and returning
-1 is simple.
If the socket knows the connection is dead, because the peer closed or there
was an affirmitive network error like a FIN coming, then libwebsockets will
take care of closing the connection automatically.
If you have a silently dead connection, it's possible to enter a state where
the send pipe on the connection is choked but no ack will ever come, so the
dead connection will never become writeable. To cover that, you can use TCP
keepalives (see later in this document)
Fragmented messages
-------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment