Mercurial > prosody-modules
comparison mod_pubsub_mqtt/mod_pubsub_mqtt.lua @ 1309:d3579ea5ff33
mod_pubsub_mqtt: Avoid tracebacks about concatenating nil field
| author | Vadim Misbakh-Soloviov <mva@mva.name> |
|---|---|
| date | Wed, 19 Feb 2014 17:57:32 +0700 |
| parents | e76f7b6be20e |
| children | 7dbde05b48a9 |
comparison
equal
deleted
inserted
replaced
| 1308:9ddfff2acddc | 1309:d3579ea5ff33 |
|---|---|
| 139 -- Build MQTT packet | 139 -- Build MQTT packet |
| 140 local packet = mqtt.serialize_packet{ | 140 local packet = mqtt.serialize_packet{ |
| 141 type = "publish"; | 141 type = "publish"; |
| 142 id = "\000\000"; | 142 id = "\000\000"; |
| 143 topic = module.host.."/"..event.node; | 143 topic = module.host.."/"..event.node; |
| 144 data = data_translators[event.item.name.." "..event.item.attr.xmlns](event.item); | 144 data = data_translators[tostring(event.item.name).." "..tostring(event.item.attr.xmlns)](event.item); |
| 145 }; | 145 }; |
| 146 -- Broadcast to subscribers | 146 -- Broadcast to subscribers |
| 147 module:log("debug", "Broadcasting PUBLISH to subscribers of %s/%s", module.host, event.node); | 147 module:log("debug", "Broadcasting PUBLISH to subscribers of %s/%s", module.host, event.node); |
| 148 for session in pairs(subscribers[event.node] or {}) do | 148 for session in pairs(subscribers[event.node] or {}) do |
| 149 session.conn:write(packet); | 149 session.conn:write(packet); |
