[Libwebsockets] Unable to send very large sized packets through websockets
"Andy Green (林安廸)"
andy at warmcat.com
Sun Nov 10 02:09:29 CET 2013
On 10/11/13 08:29, the mail apparently from Hemant Kumar included:
> I have set the size of LWS_MAX_SOCKET_IO_BUF to 64K so that I can send
> large sized packets.
> If I send 32 K packets, my callback handler is called twice as expected
> , but as I tend to approach
> 64K ,it is called every once for the packet send:
> [1384042703:8452] NOTICE: 0 997 (0) :tx 60016 <===sending 60K sized pkts
> [1384042703:8453] NOTICE: 1 998 (0) :tx 60016
> [1384042703:8458] NOTICE: LWS_CALLBACK_CLIENT_WRITEABLE
> [1384042703:8458] NOTICE: 0 999 (0) :tx 60016
> [1384042703:8464] NOTICE: LWS_CALLBACK_CLIENT_WRITEABLE
> [1384042703:8464] NOTICE: 0 1000 (0) :tx 60016
> [1384042703:8470] NOTICE: LWS_CALLBACK_CLIENT_WRITEABLE
> When I try sending 63K packet , it fails sending 9th packet with
> following error:
> [1384042832:4989] NOTICE: 1 8 (0) :tx 63016
> [1384042832:4991]*ERR: Unable to spill ext 63008 vs 49152*
You have a compression extension active on this connection?
What version of lws are you using?
> [1384042832:4991] NOTICE: 2 9 (0) :tx -1
> To get over this issue, I increased the LWS_MAX_SOCKET_IO_BUF to 128K.
> In this case as I approach 110K, it fails as:
> [1384043094:9284] NOTICE: LWS_CALLBACK_CLIENT_WRITEABLE
> [1384043094:9286] NOTICE: 0 43 (0) :tx 110028
> [1384043094:9296] NOTICE: LWS_CALLBACK_CLIENT_WRITEABLE
> [1384043094:9299] NOTICE: 0 44 (0) :tx 110028
> [1384043094:9300]*ERR: Unable to spill ext 110014 vs 102978*
> [1384043094:9300] NOTICE: 1 45 (0) :tx -1
> [1384043094:9300] INFO: libwebsocket_service_fd: closing
> [1384043094:9301] NOTICE: LWS_CALLBACK_CLOSED
> What is the maximum limit we can set on LWS_MAX_SOCKET_IO_BUFand what is
> the relation with the max size packet we can send? When I tried setting
> this to 1024K, I was not able to send a single packet.
What's wrong with sending your content in 32K chunks?
> Can you please clarify and suggest way for sending very large sized
> packet without application worrying about fragmentation ? Websocket as
> the RFC states is supposed to be message oriented protocol, so I believe
> there has to be a way not to care about frag issue associated with large
> sized packets?
The RFC explains how to use websocket fragments (not tcp fragments) to
send as much as you like, even endless streams.
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
More information about the Libwebsockets