[Libwebsockets] client protocol selection criteria discussion
olivier at olivierlanglois.net
Mon Feb 10 00:05:23 CET 2020
I feel like I am currently in uncharted waters in my lws usage and I am
discovering the limits of what is possible as I figure out how to
accomplish my design goal.
Here is some background to what I'm trying to accomplish:
1. Have a client connect to 2 different services
2. Because I don't want 1 service handling impacting the performance
and responsiveness of the other service handling, having 2 service
threads and have each connection binded to its own thread exclusively
would be ideal
3. The 2 service are 2 different protocols.
I have found that if a connection was created from a service thread, an
initial binding was created between the thread and the connection
(under which conditions could that binding be broken?).
However, the only criteria lws use to determine the protocol to use is
the Protocol header value found in the server reply. Therefore, I will
be forced to use a single callback for my 2 protocols and do the
dispatching myself from the callback.
I am throwing this idea on the list for discussion. Would it be a good
feature to make it possible to select the protocol based on the
ie: if you connect to protocolA server, use protocol A. if you connect
to protocolB server, use protocol B.
Something that I need to mention. It is that I am developing a WS
client to use existing WS services. I suspect that I'm a rare breed as
most lws users are probably developing servers to let web browsers use
their services from a webpage.
imo, that is an important detail to mention before someone suggest me
to simply change my server to include the protocol name in the reply. I
have no control on how the servers are behaving...
More information about the Libwebsockets