aLiYun.lua:
--- 设置MQTT数据通道的参数 -- @number[opt=1] cleanSession 1/0 -- @table[opt=nil] will 遗嘱参数,格式为{qos=, retain=, topic=, payload=} -- @number[opt=240] keepAlive,单位秒 -- @return nil -- @usage -- aLiYun.setMqtt(0) -- aLiYun.setMqtt(1,{qos=0,retain=1,topic="/willTopic",payload="will payload"}) -- aLiYun.setMqtt(1,{qos=0,retain=1,topic="/willTopic",payload="will payload"},120) function setMqtt(cleanSession,will,keepAlive) sCleanSession,sWill,sKeepAlive = cleanSession,will,keepAlive end
在这里设置 keepalive 参数。默认是240s:
local mqttClient = mqtt.client(clientId,sKeepAlive or 240,user,password,sCleanSession,sWill)
不应如此计算流量,犯了一叶障目的错误。
建议统计整天、整周的流量,然后乘以倍数计算月流量。计算每一条是没有用的,因为信号差导致的重连情况是你无法把控的。
http://ask.openluat.com/article/35