[Libwebsockets] lws_client_connect_via_info() - protocol 0 handler

Denis Osvald denis.osvald at sartura.hr
Wed Feb 15 10:31:58 CET 2017


On 2017-02-15 02:18, Andy Green wrote:
> On 02/15/2017 01:50 AM, Joel Winarske wrote:
[...]
> That doesn't mean much though since it knows it will generate callbacks
> in the process of connecting, and when no better protocol is capable of
> being selected (because for ws it must be negotiated with the server),
> lws uses protocols[0] for want of anything better in many places.
> 
> Client connections were until recently all ws/wss, for that this will
> work fine since the protocol is negotiated and selected later.
> 
> For HTTP[S] client until now no code to allow forcing the protocol
> selection... that works fine with all on protocols[0] in "by hand" code
> like the original test server.  But being able to target a specific
> plugin / protocol handler by name makes a lot more sense inside lwsws.
> 
> Please try this
> 
> https://github.com/warmcat/libwebsockets/commit/d23cb338654c423e74c0b0160ba275e9a57c0070
> 
> 
> pushed on master just now.
> 
> Set the info .vhost, the protocol name you want on that vhost in the
> info .protocol and there should be an info.method set already indicating
> http GET or whatever.  Then it will attempt to select the protocol from
> the vhost early in the connection action.

Hmm, I don't seem to get what this change does exactly. Would
protocols[0] still be called for things like:
- FD / extpoll stuff
- extra SSL info callbacks
- client connection error (CCE)
- callbacks before we know we'll upgrade to ws(s)
- callbacks after we've upgraded to ws(s)
- callbacks after we know no upgrade to ws(s) will happen
(Does the last type of client callback even exist?)

In other words, what callback reasons are moved from protocols[0] to the
selected-by-name protocol callback?


Regards,

Denis Osvald

> 
> -Andy
> 
>>
>>
>> Thanks,
>> Joel
>>
>>
>> _______________________________________________
>> Libwebsockets mailing list
>> Libwebsockets at ml.libwebsockets.org
>> https://libwebsockets.org/mailman/listinfo/libwebsockets
> 
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets



More information about the Libwebsockets mailing list