[Libwebsockets] HTTP persistent connection from libwebsockets. It's possible?

Andy Green andy at warmcat.com
Thu Feb 20 17:38:36 CET 2020



On 2/20/20 1:03 PM, Андрей Морозов wrote:
> Hello!
> 
> Can I create new HTTP transactions (requests) without creating new 
> connection using the libwebsockets library (persistent HTTP connection)?

I assume you're creating client connections...

If you want a really persistent connection, you can get it with http/2. 
If it's pipelining of connections to the same endpoint using one tcp / 
tls connection, you can get it on h1 or h2 by specifying the connection 
should use pipelining by giving the LCCSCF_PIPELINE flag.

https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/http-client/minimal-http-client-multi/minimal-http-client-multi.c#n404-406

-Andy

> For example:
> 
> GET /index.html HTTP/1.0
> Host: www.sample.com <http://www.sample.com>
> Connection: Keep-Alive
> 
> GET /1.jpg HTTP/1.0
> Host: www.sample.com <http://www.sample.com>
> Connection: Keep-Alive
> 
> GET /1000.jpg HTTP/1.0
> Host: www.sample.com <http://www.sample.com>
> Connection: close
> 
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
> 


More information about the Libwebsockets mailing list