[Libwebsockets] polling for file descriptor i/o

Andy Green andy at warmcat.com
Sat Feb 18 22:32:53 CET 2017



On 02/18/2017 01:45 AM, Per Bothner wrote:
> ldomterm waits for output from the child process by running select in
> a separate thread:  See the code in:
>
> https://github.com/PerBothner/DomTerm/blob/master/lws-term/protocol.c
>
> This works, but it seems clumsy and wasteful, since lws has its own event
> loop using select/poll.
>
> Is there any mechanism to add a file descriptor to the lws event
> loop and have a callback function fire when data arrives?
> Perhaps this could use a new pseudo-protocol?
>
> (Not a big deal, but maybe worth thinking about if changing
> the VFS data structures.)

There are socket adoption APIs in lws, but they currently only adopt 
stuff expected to be in http or https logical protocol.

There's another guy asking for this on github

https://github.com/warmcat/libwebsockets/issues/778

but he wants something a bit less reasonable related to being able to 
accept arbitrary raw connections on the same listen socket as http - and 
https .  However doing that also requires raw adoption you want 
underneath.  So I will try to provide it.

-Andy




More information about the Libwebsockets mailing list