[Libwebsockets] lws_adopt_socket() vs. external polling
Andy Green
andy at warmcat.com
Fri May 22 19:04:02 CEST 2020
On 5/22/20 5:14 PM, John Peter Norair wrote:
> Hi LWS readers:
>
> A few days ago I asked some questions about external polling. In the
> time since, I’ve been experimenting with custom and standard-builds of
> LWS, and it’s my impression that external polling is not always
> compiled-in to LWS.
It is off by default at cmake, because external polling is a hack.
> I ended up using lws_adopt_descriptor_vhost() to allow the LWS service
Those two things are kind of unrelated...
- External polling: allows you to hack lws to use something else's
event loop without making any assumptions about what it is or how it
works or is locked
- adopt_descriptor: lws makes a wsi for your existing socketfd and
treats it as one of its own. But it doesn't say anything about how the
event loop works.
> loop manage everything. This seems like a more portable solution than
> external polling.
Yeah... that is for nasty situations you have to interface lws to some
gnarly existing system with its own event loop deeply emebedded init
unrelated to any normal conventions . For everything else, lws supports
libuv, libevent, libuv, glib event loops, by default it makes its own
poll() or select() -based event loop for you.
-Andy
> My software is for bridging arbitrary UNIX or ubus sockets onto
> websockets. Perhaps it can be optimized with LWS integrated proxying,
> but I’ll explore that later. If anyone is interested in such software,
> it’s on github now (albeit still a rough alpha):
> https://github.com/jpnorair/wfedd
>
> Best regards,
> JPN
>
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
>
More information about the Libwebsockets
mailing list