From f18ed5f3ff71c03136fab4c3766d2568b5349925 Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 5 Sep 2024 21:36:53 +0200 Subject: [PATCH] feat: support CONNECT packets >127 bytes --- mqtt.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mqtt.lua b/mqtt.lua index e7c7a61..6a895ce 100644 --- a/mqtt.lua +++ b/mqtt.lua @@ -158,11 +158,7 @@ function MqttClient:connect (username, password) flags = flags | 0x40 end - if length > 127 then - return "packet size exceeds current implementation capabilities" - end - - local data = string.pack("> B B s2 B B I2 B s2", 0x10, length, "MQTT", 5, flags, 0, 0, "") + local data = string.char(0x10) .. encodeVarint(length) .. string.pack("> s2 B B I2 B s2", "MQTT", 5, flags, 0, 0, "") if username ~= nil then data = data .. string.pack("> s2", username) end