[Libwebsockets] Traffic

Andy Green andy at warmcat.com
Thu May 16 09:16:37 CEST 2019

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