[Libwebsockets] Can i use lws_uv_timeout_cb in libuv for dispatching massages in my server app?

Andy Green andy at warmcat.com
Fri May 27 12:37:36 CEST 2016



On 05/27/2016 06:15 PM, Meir Yanovich wrote:
> Hello
> i notice that the libuv example is using :
> uv_timer_start(&pt->uv_timeout_watcher, lws_uv_timeout_cb, 10, 1000);
> and this timer invoking endlessly the lws_uv_timeout_cb .

That's nothing to do with a "libuv example".  This is in the libuv 
support in lws itself.

If you're using a libuv loop, lws itself has to arrange a callback every 
second to check timeout status on anyone who has a live timeout going, 
that's what this timer does.

> in my server i need to use endless loop which will check some
> queue's or tasks which needs to be served back to the client or
> internally in the server .
> can i call the function which check and invokes the tasks from
> lws_uv_timeout_cb?

No.  You should make your own libuv timer.

The thing you're looking at is an internal timer used to manage 
connection timeouts, it's not for user code use.

Have a look at how the dumb-increment plugin deals with needing to send 
packets at 20Hz.

https://github.com/warmcat/libwebsockets/blob/master/plugins/protocol_dumb_increment.c

-Andy

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



More information about the Libwebsockets mailing list