forked from luca/mineqtt
fix: export open function
This commit is contained in:
parent
18875eb860
commit
0d88c472fa
10
mqtt.lua
10
mqtt.lua
|
@ -1,4 +1,4 @@
|
||||||
local net = require("internet")
|
local mqtt = {}
|
||||||
|
|
||||||
local read_varint = function (conn, first_byte)
|
local read_varint = function (conn, first_byte)
|
||||||
local b
|
local b
|
||||||
|
@ -26,10 +26,10 @@ local read_varint = function (conn, first_byte)
|
||||||
return n + (b << s), nil
|
return n + (b << s), nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local MqttClient
|
local MqttClient = {}
|
||||||
|
|
||||||
function open (address, port)
|
function mqtt.open (address, port)
|
||||||
local conn = net.open(address, port)
|
local conn = require("internet").open(address, port)
|
||||||
if conn == nil then
|
if conn == nil then
|
||||||
return nil, "connection failed"
|
return nil, "connection failed"
|
||||||
end
|
end
|
||||||
|
@ -171,3 +171,5 @@ function MqttClient:disconnect (reason)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return mqtt
|
||||||
|
|
Loading…
Reference in New Issue