[Libwebsockets] Does libwebsocket fit to my needs?

Andy Green andy at warmcat.com
Thu Sep 4 14:18:02 CEST 2014



On 4 September 2014 20:04:18 GMT+08:00, Alexander Eisenhuth <ae at stacom-software.de> wrote:
>Thanks for the quick reply
>
>>> Hello together,
>>>
>>> before diving into libwebsockets, I want to figure out weather this
>lib
>>>
>>> is what I'm looking for and fit into the architecture of my project.
>>>
>>> I've to say that I'm no expert in Websockets, so forgive me about
>>> "dumb
>>> question".
>>>
>>> I developed a component running under linux on x86 and arm11. The
>build
>>>
>>> environment is gcc 4.7.2 an d cmake 2.8.
>>>
>>> The application is a component behind a lighttpd web server. The
>client
>>>
>>> uses JSON encoded HTTPS requests. These requests are passed with
>>> mod_fcgi to my component, processed there and the answer send back
>as
>>> JSON encoded answer. So far so good.
>>>
>>> Now a new requirement is to send status data of the embedded device
>>> asynchrously to clients. For that purpose Websockets shall be used.
>>>
>>> Lighttpd doesn't support Websockets out of the box. There exists
>>> mod_websocket, but it seems to be well supported.
>>>
>>> So it looks like I've to integrate a new library supporting
>Websockets
>>> into the am11/x86 platform.
>>>
>>> Requirements:
>>> - The idea is to start/stop the periodical delivery of status data
>with
>>>
>>> a HTTPS/JSON Request
>>> - Status data must be encrypted
>>>   (ideally use the existing HTTPS connection of lighttpd)
>>> - Footprint of the library must be low (~100KB ROM/RAM)
>>> - Multiple client must be able to get the status data
>>
>> You should be able to do everything with lws and eliminate lighttpd.
>>
>> You can eliminate fcgi too and emit your json direct from lws user
>callback.
>>
>>> Questions:
>>> - Can this be achieved using libwebsockets?
>>> - How can that be done?
>>
>> Clone the git and build and study the test apps, particularly the
>test server.
>
>Elimination lighttpd is unfortunately not possible. I must integrate
>the 
>websocket lib in the existing architure.

Well, lws doing the http is the 'existing architecture' of lws.

>So is it possible to expose a websocket interface (ws://<embedded 
>device>/status) with the help  of lws.

Not easily.

If you want to use lighttpd you should probably look for something other than lws.

>What is the communication between clients and the websocket server?

.... what do you mean?  Obviously, websocket protocol.

>What about ssl encryption?

Why don't you spend 10 minutes cloning the library and looking at the samples.

Or if you want to use lighttpd just abandon lws and keep looking for something else.

-Andy



More information about the Libwebsockets mailing list