[Libwebsockets] Problem sending more than 3263 bytes on ws

Andy Green andy at warmcat.com
Thu Jun 28 05:05:49 CEST 2018



On 06/27/2018 11:36 PM, pierre30 at gmail.com wrote:
> Hello,
> 
> I have a problem when sending more than 3263 bytes on websocket using 
> lws_write() function. The problem appears with firefox and libwebsocket 
> version 3.0.I had no problem with version 2.0 whatever the browser I 
> used. It’s still good with Edge and version 3.0.
> 
> When I try to send 3264 bytes, I receive 3421 bytes (+ 157 bytes) in the 
> Javascript on Firefox. Idem when I try to send more bytes, the 
> Javascript receive extra bytes in multiples of 157. If I try to send 
> 41990 bytes, I receive 42304 bytes (+ 2*157 bytes).

Are these "extra bytes" recognizable as being related to what should 
have been sent?  Like the last 157 bytes repeated, etc?

> On the libwebsocket side here are the following notice messages (no 
> notice when connected with Edge):
> [2018/06/27 16:26:41,519] Send WS: size = 3264
> [2018/06/27 16:26:41,519] NOTICE: write drain len 1019 (wp 0x1) SETTING 
> tx_draining_ext

Hmm you seem to be using permessage-deflate compression extension.

You can do that but you have some extra constraints to be aware of.

> [2018/06/27 16:26:41,519] lws_write() return: 3264
> [2018/06/27 16:26:41,549] NOTICE: rops_write_role_protocol_ws: CLEARING 
> tx_draining_ext
> [2018/06/27 16:26:41,549] NOTICE: FORCED draining wp to 0x02 (stashed 
> 0x01, incoming 0x01)
> 
> 
> [2018/06/27 16:24:42,460] Send WS: size = 41990
> [2018/06/27 16:24:42,465] NOTICE: write drain len 1019 (wp 0x1) SETTING 
> tx_draining_ext
> [2018/06/27 16:24:42,465] lwswrite() return: 41990
> [2018/06/27 16:24:42,498] NOTICE: rops_write_role_protocol_ws: CLEARING 
> tx_draining_ext
> [2018/06/27 16:24:42,498] NOTICE: FORCED draining wp to 0x02 (stashed 
> 0x01, incoming 0x01)
> [2018/06/27 16:24:42,498] NOTICE: write drain len 1024 (wp 0x2) SETTING 
> tx_draining_ext
> [2018/06/27 16:24:42,545] NOTICE: rops_write_role_protocol_ws: CLEARING 
> tx_draining_ext
...
> 
> I don’t understand what the notice means and what I can do in 

They shouldn't be NOTICE but more like DEBUG or EXT, they seem to have 
been left like that accidentally from debugging.  They are just 
informing about progress of sending stuff.

> libwebsocket to have something working on Firefox?

My guess is disabling the extension will make it "go away" but it's not 
really fixing anything.

It's surprising since we run autobahn now on travis commits.

Could you maybe take a look at

https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/ws-server/minimal-ws-server-pmd-bulk

and see if that has the same problem when aligned to what your code is 
doing (or align your code to what that's doing...)

-Andy


> Thanks,
> Pierre.
> 
> 
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
> 



More information about the Libwebsockets mailing list