[Libwebsockets] Ways to send multiple client request on the same wsi
andy at warmcat.com
Wed Aug 22 08:28:58 CEST 2018
On 08/21/2018 12:09 AM, Xi Chen wrote:
> I have two issues (maybe observations) which needs some clarifications:
> Currently I send one H2 client request vis
> lws_client_connect_via_info(), it creates one network wsi (nwsi) and
> then one h2 child wsi (h2_wsi). When I return -1 in the callback, it
> frees h2_wsi only. Why nwsi is not close?
(I must say I am gratified to hear someone talk about nwsi. After
spending many months working on h2 support it's the first time someone
read the code AFAIK.)
It stays open for some time in case you have more client connections to
the same host coming.
Since v3.0 lws has a pretty sophisticated transparent queuing for multi
client connection to the same vhost, that works on http/1.1 pipelining
if that's what you got or h2, broadsiding the connections concurrently
on a single TLS / tcp "nwsi".
> If I want to send the same request again, seems I need to call
> lws_client_connect_via_info() again which creates nwsi and h2_wsi
> again (i.e., SSL handshake again), is there a way I can reuse the
> previous allocated nwsi and h2_wsi?
If the nwsi is still up, it should use it.
Have a play with:
this has switches that let you test multiple client connections
simultaneously or with with staggered delays (to stress the queuing
algorithm) in h1, h1 with pipelining and h2. Various combinations of
this run as part of the CI testing on travis against both a local server
If there are problems coming, talking about how to reproduce them with
that + whatever hack patch is needed will make it much easier to look at it.
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
More information about the Libwebsockets