[Libwebsockets] write complete client response back to parent

Joel Winarske joel.winarske at gmail.com
Fri Feb 17 01:46:09 CET 2017

I'm calling the "parent" wsi, that which is responsible for the client

I'm figuring in user land I would do something like this:
get response value here -> LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP &&
read/write here -> LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ (chunked)

Sound about right?


On Thu, Feb 16, 2017 at 3:12 PM, Andy Green <andy at warmcat.com> wrote:

> 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
> >(status
> >+ 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.
> -Andy
> >
> >Thanks,
> >Joel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20170216/3dfd7151/attachment-0002.html>

More information about the Libwebsockets mailing list