[Libwebsockets] pointers for implementing websocket tcp gateway and a static http server
jsaak at napalm.hu
Wed Oct 12 09:38:49 CEST 2016
On 10/12/2016 09:25 AM, Andy Green wrote:
> On Wed, 2016-10-12 at 09:16 +0200, jsaak wrote:
>> I have an app which works under linux/android/ios/osx/windows, and
>> TCP/IP to communicate. I want to bundle a websocket to tcp gateway
>> the app so i can access it through a browser. Also i want to include
>> static http server.
>> I found libwebsockets, and i think it might be a solution.
> Sounds like the right kind of task for lws.
>> All I ask of you is some advice. How to start with libwebsockets? It
>> a bit confusing for me.
> Run the test server is the best way to get started.
> The key question is "How does your existing app wait on network events
> at the moment"? It's like poll() or like an event loop?
> If it already has its own poll() management, you should look at using
> External Poll support to integrate lws with it.
> If it uses an event loop, lws has libuv (preferred) and libev event
> loop support, you can integrate using that.
> How nice a ride you get is mainly depending on the existing app's wait
> for network events method.
I am using SDL_Net which uses select() on all platforms i think.
But it may be irrelevant, since i want to put libwebsocket to a new
thread (so i can use any event loop there), and only communicate with it
I think libuv is the way to go for me. So shall i start with
Do I have to make a default websocket protocol? And in that protocol i
have to open/read/write/close the real TCP connection?
More information about the Libwebsockets