[Libwebsockets] write complete client response back to parent

Andy Green andy at warmcat.com
Fri Feb 17 00:12:33 CET 2017

On February 17, 2017 4:19:54 AM GMT+08:00, Joel Winarske <joel.winarske at gmail.com> wrote:
>Hi Andy,
>What method would you suggest to write the complete client response
>+ headers + data) back to the parent?

I don't really follow (because you don't explain) what 'parent' means to you.

If 'parent' is ultimately another socket, and you want to write the client rx back out on that, the basic point is don't consume the incoming client rx until the outgoing socket is writable.  This means the outgoing socket effectively flow-controls reading the incoming client data.

The client rx is in two parts, the callback to notify something came, and then an api call to get / consume it, exactly to facilitate your asking for a callback when something else becomes writable in response to "something came on your client connection" message appears, and get / consume the client rx only when the onward socket's writable callback comes.

For headers, lws doesn't keep them verbatim, but you can dump the ah version. Status is also in there.



More information about the Libwebsockets mailing list