[Libwebsockets] Confusion about contexts/vhosts/protocols

Zevv libws at zevv.nl
Thu Jun 20 13:36:20 CEST 2019

Hi all,

I started looking into libwebsockets today to see if it could replace a
lot of custom code in one of our products. I'm trying to build a simple
test app which should perform an outgoing HTTPS request and at the same
time accept generic TCP clients on listening port.

  Code is at http://paste.ubuntu.com/p/QYwnmVw77h/

I have created a context with EXPLICIT_VHOST, and created two vhosts:
one for the server and one for the client context. The server vhost
has the _ADOPT_APPLY_LISTEN_ACCEPT_CONFIG option and listen_accept_*
fields set.

I now find this kind-of-works, but the behaviour depends on the order of my
protocols in the lws_protocols passed to lws_create_context(): if the
"http-client" protocol is put first, the server vhost will not handle the
connection with the "raw-test" callback, even though that is explictily
configured in listen_accept_protocol.

Where in the documentation could I find a good description of whis

Thank you!

More information about the Libwebsockets mailing list