(encode-fixed-header packet out)(encode-remaining-length packet out)(encode-remaining-length packet out x)Encode MQTT's funky multi-byte remaining-length field. It needs to use the algorithm from the MQTT 3.1 Spec: http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html
do digit = X MOD 128 X = X DIV 128 // if there are more digits to encode, set the top bit of this digit if ( X > 0 ) digit = digit OR 0x80 endif 'output' digit while ( X> 0 )
Encode MQTT's funky multi-byte remaining-length field. It needs to use the
algorithm from the MQTT 3.1 Spec:
http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html
do
digit = X MOD 128
X = X DIV 128
// if there are more digits to encode, set the top bit of this digit
if ( X > 0 )
digit = digit OR 0x80
endif
'output' digit
while ( X> 0 )
(make-encoder & {:keys [error-fn] :or {error-fn identity}})cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |