[Libwebsockets] Websocket frame size

Andy Green andy at warmcat.com
Sat Sep 19 20:33:38 CEST 2020

On 9/19/20 6:38 PM, Mykola Stryebkov wrote:
> Hi,
> I’m probably missing something.
> Is there any way to know the size of received websocket frame?

You can find how many bytes are left in the current fragment, but that 
may not be as useful as you are hoping


Ws fragments are analogous to tcp frames, they may be refragmented by 
intermediaries and their size is a function of something unrelated to 
the payload, the mtu or the buffering arrangements at the sender or an 

The message, made up of one or more fragments is the logical unit that's 
transferred over ws, and its length isn't known beforehand if it comes 
in multiple fragments, you keep appending fragments until you see one 
with the FIN bit set.

You can find out if this RX is the final one with this.



More information about the Libwebsockets mailing list