
Exploring WebSocket Part 3: Handling Fragmentation
What Is Fragmentation and Why We Care About It? Imagine we have a stream of subtitle from a 10 minute video. Subtitle is being render on client side in real time as video playing through WebSocket connection. How the whole subtitle sent successfuly to client? If we answer just send whole subtitle , the answer is less precise. Let's step back to previous article where we discusses about payload length. RFC states maximum payload length in single frame. WebSocket RFC limits message payload in a single frame, where it capped at 2^63 bytes. Consequently, a frame with it's message payload exceeds 2^63 bytes is non-compliant. To make it compliant, that frame should comply fragmentation. Fragmentation is a protocol to split complete WebSocket message into multiple frames. For example, consider a complete text message abcdefgh . We can send that message as one complete text frame or multiple text frames by apply fragmentation protocol. Number of text frames is arbitrary in count, not in struct
Continue reading on Dev.to Webdev
Opens in a new tab



