Re:WebSockets is a stream, not a message based protocol
by marshray on Wednesday December 21, 2011 @02:36PM
(#3378777)
But we're talking about messages, not frames. http://tools.ietf.org/html/rfc6455 "frames have no semantic meaning"
If Websocket developers begin making unwarranted assumptions about message framing and fragmentation you will regret it. BELIEVE ME.
/me gets back to bugfixing
So, if I can read 2 bytes from my buffer, I can get a good idea of the message size. If I only have 1 byte, I rewind and wait until I receive another.