[Libwebsockets] lwsws and plugins on master

Andy Green andy at warmcat.com
Wed Apr 6 13:48:29 CEST 2016

On 04/06/2016 04:50 PM, Andy Green wrote:
> Hi -
> I just pushed another update on master about lwsws.
> Since 1.7 I added
>   - lwsws itself,
>   - its JSON config system,
>   - vhost support in lws which it uses,
>   - CGI and proxying support
> and now on Linux at least, support for providing protocols and
> extensions (just protocols right now) in plugins.
> These plugins are very small, compact instances of "a ws protocol",
> where all the definitions and init are managed in the plugin itself.
> Actually the support for this is in lws, lwsws just uses it.
> They are independently instantiated and destroyed per vhost, and can
> make per-vhost allocations as well as per-connection allocations.
> This works well now, lwsws can start up and do the test html completely
> just using plugin versions of the protocols, without any init or
> knowledge in lwsws itself.  He's still valgrind clean.
> This should end up very convenient that for server, the boilerplate code
> can be replaced by generic lwsws, and the only user code is a protocol
> plugin... and these are very simple, eg
> https://github.com/warmcat/libwebsockets/blob/master/plugins/protocol_dumb_increment.c
> For server case this should give a much simpler and more selfcontained
> option than cut-and-pasting the test server.
> lwsws is disabled by default in cmake, if it's enabled with cmake
> -DLWS_WITH_LWSWS=1 then it also enables libuv and plugin support in the
> library.
> There are two problems left maybe someone can help me with.
> 1) When the plugins are linked, they link against the library .a... this
> bloats the plugins with a copy of the library needlessly.  Can anyone
> see what I am doing wrong in cmake?
> 2) I added a test to travis enabling LWSWS, but he dies in cmake because
> he can't find libuv.  How can I add libuv to the travis context that
> runs the tests?  It seems to have libev already.

I realized there's a second script that sets up the environment for 
libev, so I adapted it to also fetch libuv.  However the libuv in 
Precise (which is what our Travis was using) is very old, 0.10 or so 
when Fedora is on 1.4.

I updated the travis test basis to Trusty, but the libuv is still too 
old.  I adapted the few api changes with a libuv header version check to 
make it build even so.  But one api change about the lack of control 
over the libuv loop is fatal.  So if you try to run it with such an old 
libuv it'll give an error message about it.

At any rate it can now pass Travis again also with building lwsws + plugins.


> -Andy
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://libwebsockets.org/mailman/listinfo/libwebsockets

More information about the Libwebsockets mailing list