comparison mod_pubsub_mqtt/mqtt.lib.lua @ 5114:d2a84e6aed2b

mod_pubsub_mqtt: Switch to MQTT 3.1.1 Well that was easy.
author Matthew Wild <mwild1@gmail.com>
date Fri, 16 Dec 2022 22:30:47 +0000
parents 7dbde05b48a9
children
comparison
equal deleted inserted replaced
5113:85a7304cfea1 5114:d2a84e6aed2b
52 length = length + bit.band(digit, 0x7f)*multiplier; 52 length = length + bit.band(digit, 0x7f)*multiplier;
53 multiplier = multiplier*128; 53 multiplier = multiplier*128;
54 until bit.band(digit, 0x80) == 0; 54 until bit.band(digit, 0x80) == 0;
55 packet.length = length; 55 packet.length = length;
56 if packet.type == "connect" then 56 if packet.type == "connect" then
57 if self:read_string() ~= "MQIsdp" then 57 if self:read_string() ~= "MQTT" then
58 module:log("warn", "Unexpected packet signature!"); 58 module:log("warn", "Unexpected packet signature!");
59 packet.type = nil; -- Invalid packet 59 packet.type = nil; -- Invalid packet
60 else 60 else
61 packet.version = self:read_bytes(1):byte(); 61 packet.version = self:read_bytes(1):byte();
62 packet.connect_flags = self:read_bytes(1):byte(); 62 packet.connect_flags = self:read_bytes(1):byte();