andy at warmcat.com
Tue Apr 22 03:19:42 CEST 2014
On 22 April 2014 10:08:54 GMT+09:00, "Julio A. Becerra" <julioabg at gmail.com> wrote:
>Thanks for the answer!
>Well, let's say that a client is connected to my libwebsockets server.
>some event occurs, I want to send (write) something to this client, so
>request the callback on writable.
>When the job is done (everything is sent), I do not want to close the
>connection, I want the client to keep connected. But my callback
Yes it's normal, you should send your last thing and then not ask for a callback on writeable. Almost 0 cpu will be used in that case.
>is still being continuously called because I cannot find a way to
Who is doing the request to callback on writeable in that case? Something in the library or your code?
>Hope my explanation is clear enough. In short: the client is always
>connected, and I want to request the callback on writeable at my
>convenience... so I need a way to remove the request.
>2014-04-22 2:59 GMT+02:00 Andy Green <andy at warmcat.com>:
>> On 22 April 2014 09:39:29 GMT+09:00, "Julio A. Becerra" <
>> julioabg at gmail.com> wrote:
>> >I am new to libwebsockets and I have a question I couldn't solve
>> >Since we have to call libwebsocket_callback_on_writable in order to
>> >a callback when the socket is able to be written, is it possible to
>> >this request when we don't need to write on the socket for a while?
>> >saving CPU cycles.
>> >I guess there should be a trivial way to do it, besides implementing
>> >own custom functions.
>> Sorry not sure I get your point.
>> If you do not request the callback when writeable, no cpu cycles will
>> When something happens that you want to write something, only call it
>> to get that job done.
>> There's no need to keep calling it forever when there's nothing to
>> >Libwebsockets mailing list
>> >Libwebsockets at ml.libwebsockets.org
More information about the Libwebsockets