[Libwebsockets] lwsws and plugins on master

Andy Green andy at warmcat.com
Wed Apr 6 10:50:51 CEST 2016


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.

-Andy



More information about the Libwebsockets mailing list