local function createConnect(token, uid) local cjson = require("cjson") local server = 'connect.unitx.pro' local endpointState = "/state/"..(uid or os.flashEUI()) local function send(parameters) local body = cjson.encode(parameters) local res, code, msg = pcall(net.http.post, server, endpointState, "application/json", "id: "..token, body, true) return res, res and msg[1] or code end return { send = send, } end return createConnect --[[ local connect = createConnect(token) connect.send({value1 = 21, value2 = 22, type=2}) ]]--