[Libwebsockets] Q: websockets frame properties
mail17 at mah.priv.at
Mon Jun 23 14:27:56 CEST 2014
sorry if I ask something obvious, but I'm not deep enough into the ws specs:
1. assuming binary write: are frame boundaries guaranteed to be preserved ? Can I rely on JS interpreters receiving them as the unit sent ?
2. are zero-lenght frames legit and preserved?
the background of the question - do I need to explicitly add a frame length field if I do this:
several projects try to bridge zeroMQ sockets to JS via websockets; doing that properly requires retaining the zeromq message structure, which is in a nutshell:
- all frames are size/buffer notation (explicit length field, no interpretation of buffer contents)
- zero-length frames are legit and have a meaning at the protocol ZMTP  level, so must be preserved
- several frames may be grouped into what is called a multipart message, a sequence of several frames; this is usally done by a flag value tacked onto each frame (ZMQ_MORE !=0 meaning - more frames coming)
to map multipart messages onto ws frames, I guess we need:
- guarantee frame boundaries are retained (if the ws protocol guarantees that - fine, if not, a length field is needed)
- retain zero length frames (either by that explicit length field, or if the ws protocol guarantees that - fine too)
- provide the more/final flag - maybe just a bit in the length field
thanks in advance! it's really about blunder prevention, so advice appreciated.
ZMTP: see section 'Framing' which explains how zeromq frames are assembled: http://rfc.zeromq.org/spec:15
More information about the Libwebsockets