Is there a good way to subscribe to multiple topics?
If I parse multiple subscribe commands I either get a sending in process panic :
m:connect("192.168.11.10", 1883, 0, function(conn)
print("connected")
m:subscribe("test",0, function(conn) print("subscribe test")
end)
m:subscribe("test2",0, function(conn) print("subscribe test2")
end)
end)
response :
> dofile('mqtt_test.lua')
> connected
PANIC: unprotected error in call to Lua API (mqtt_test.lua:21: sending in process)
of if I nest the subscriptions, they are repeated :
m:connect("192.168.11.10", 1883, 0, function(conn)
print("connected")
m:subscribe("test",0, function(conn) print("subscribe test")
m:subscribe("test2",0, function(conn) print("subscribe test2")
end)
end)
end)
Response :
> dofile('mqtt_test.lua')
> connected
subscribe test
subscribe test2
subscribe test2
Helix