[Libwebsockets] Traffic

Marcel Isenbügel M.Isenbuegel at smart4energy.com
Thu May 16 09:39:01 CEST 2019

Ah okay,

thank you for the fast answer. 

On the Server I set the ws_ping_pong_interval = 5. So because of this I had little bit of traffic every 5 seconds.

I had at 5seconds 17280 ping/pong a day *  x Bytes (e.g. 16 Bytes each ping/pong) = 276,48 kBytes. So that’s not so much :)

But now I  know where I can set the parameter.

Best regards 


-----Ursprüngliche Nachricht-----
Von: Andy Green [mailto:andy at warmcat.com] 
Gesendet: Donnerstag, 16. Mai 2019 09:17
An: libwebsockets at ml.libwebsockets.org; Marcel Isenbügel; libwebsockets at ml.libwebsockets.org
Betreff: Re: [Libwebsockets] Traffic

On May 16, 2019 7:53:52 AM GMT+01:00, "Marcel Isenbügel" <M.Isenbuegel at smart4energy.com> wrote:
>Hey everyone,
>i want to know how much traffic libwebsockets is using when i have
>24hours a connection opened. And no Messages will be send. So just
>If someone has an value it would be nice to know because for my
>calculation when using libwebsockets with a gsm connection (Limited

Assuming it's ws, by default, zero.

But your connection may not stay up continuously if there's really no traffic... intermediaries and servers don't want to dedicate resources that are idle for unlimited periods.  And if there's truly no traffic, it's ambiguous as to whether it's because both sides are comfortably silent, or because the other side or some intermediary dropped dead quietly a while back.

So to be able to confirm at intervals you're still in a conversation, it's usual to send some kind of ping / pong occasionally... some kinds of connection failure can only be detected if you try to write something.

So the answer is 'depends' on how quickly you want to uncover dead connections (so you can reconnect), which decides the ping interval.  Ws pings / pongs without a payload are only a couple of bytes.


>Best Regards,

More information about the Libwebsockets mailing list