[Libwebsockets] lwsws and plugins on master

Andy Green andy at warmcat.com
Fri Apr 8 11:15:42 CEST 2016



On 04/08/2016 05:04 PM, Denis Osvald wrote:
> Hi,
>
> On 04/08/2016 06:06 AM, Andy Green wrote:
>> microsoft decided to not provide dirent.h with their platform and
>> plugins need to be done differently on windows
>
> I have lwsws depends on libuv, what about using uv_fs_scandir and friends:
>
> http://docs.libuv.org/en/v1.x/fs.html#c.uv_fs_scandir_next

Thanks, I didn't know that existed... if he can do the equivalent of 
scandir alphasort I can convert it myself easily enough then.

> This ties libwebsockets closer to libuv though.

No only lwsws depends on libuv now... that's optional at cmake (indeed 
off by default) as is libuv support.  Similarly the only place using 
scandir() is lwsws.  So it won't infect anything else than lwsws with 
dependency on libuv.

The reason it needs binding to libuv or something similar is as  I 
converted the existing example protocols to plugins, it became obvious 
the existing way the examples are done

  - staticly defined objects

  - everything application-wide, not per-vhost

  - "magic init" in the user main() for protocol-specific things like 
dumb increment timer

was fine for small embedded statically-linked single applications, but 
actually it's not what you want if you want to provide a generic ws 
protocol implementation one time. [1]

So for the case of dumb_increment, he needs a crossplatform way of 
calling his increment action and that's something libuv is very good at.

-Andy

[1] I also have added the ability to pass config at protocol init time 
per-vhost, with the config coming from JSON for lwsws.

> Regards,
>
> Denis
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://libwebsockets.org/mailman/listinfo/libwebsockets
>



More information about the Libwebsockets mailing list