Skip to content

WebSocket cuts off buffers over 528 bytes #81

Answered by willmmiles
timleg002 asked this question in Q&A
Discussion options

You must be logged in to vote

If one or more of the devices in question is an ESP8266, the LwIP TCP stack defaults to a MSS (maximum segment size) of 536. This means it sends and receives no more than 536 payload bytes per packet. I don't know much about the WebSocket protocol specifically, but add a little framing overhead and 528 is a reasonable maximum payload to expect in a single call.

The onEvent() callback is called for every data packet handed up by LwIP. You should be able to tell you've received only partial data via comparing len to info->len -- info->len carries the original event size, while len is the number of bytes received in this packet. If len < info->len, you're responsible for doing your own buffe…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@timleg002
Comment options

@mathieucarbou
Comment options

@timleg002
Comment options

@willmmiles
Comment options

Answer selected by timleg002
@timleg002
Comment options

@mathieucarbou
Comment options

@mathieucarbou
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants