[Libwebsockets] http client callback owner

Joel Winarske joel.winarske at gmail.com
Sun Apr 23 22:30:33 CEST 2017


I noticed that when initiating a connection to ws or wss, it will use the
"protocol" value for the "sec-protocol" header.  So if my local lwsws
protocol is named "xyz", and I set protocol to "xyz" as I want to own the
http client callbacks in my plug-in, when I connect to the ws/wss endpoint,
it will send the "sec-protocol" value of "xyz".  The protocol handler and
actual protocol name for far end connect should be different.  If protocol
is null, then I would expect "sec-protocol" not to be added to the
headers.  What do you think?


On Sat, Apr 22, 2017 at 4:20 PM, Andy Green <andy at warmcat.com> wrote:

>
>
> On 04/23/2017 06:20 AM, Joel Winarske wrote:
>
>> Do the CLIENT callbacks only happen on protocol index 0, or do they
>> happen on which ever protocol the client was initiated from?  Meaning do I
>> get a separate client handler per protocol, or just the global handler via
>> protocol 0?  I've only had a need to use the global scheme via protocol 0,
>> until now.
>>
>
> Since the last few weeks on master very early in the client connection
> process the client wsi gets its protocol pointer set to the vhost instance
> of the named protocol given in the client connection info.  So since then
> even things like CONNECTION_ERROR are targeted at the vhost instance of the
> named protocol.
>
> The reason is I had a use myself for client stuff selfcontained in the
> context of a "plugin" for ESP32 Over The Air update support... it became
> clear then everything should be called back into the plugin for client
> too...
>
> https://github.com/warmcat/libwebsockets/blob/master/plugins
> /protocol_esp32_lws_scan.c
>
> -Andy
>
>
>
>> -Joel
>>
>>
>> _______________________________________________
>> Libwebsockets mailing list
>> Libwebsockets at ml.libwebsockets.org
>> https://libwebsockets.org/mailman/listinfo/libwebsockets
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20170423/16870ebc/attachment-0002.html>


More information about the Libwebsockets mailing list