[Libwebsockets] lws_vhost from lws_context struct

Andy Green andy at warmcat.com
Mon May 13 11:02:20 CEST 2019



On May 13, 2019 9:55:06 AM GMT+01:00, Maarten Hoeben <hamster at xs4all.nl> wrote:

>I can’t find a function to get a lws_vhost from the lws_context
>structure. Such a function would be use to find out after context
>creation which port the vhost was bound to incase of implicit vhost
>creation. Currently the vhost structure is only obtainable from a lws
>structure, which can not be had from the lws_context structure AFAIK.

You can handle this by telling lws to just create the context without any vhost

https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/http-server/minimal-http-server-multivhost/minimal-http-server.c#n110

and then create the vhost(s) explicitly, you can use the same info struct.

https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/http-server/minimal-http-server-multivhost/minimal-http-server.c#n135-143

this lets you get pointers for n vhosts, not just the default one.

-Andy

>Maarten Hoeben
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>https://libwebsockets.org/mailman/listinfo/libwebsockets


More information about the Libwebsockets mailing list