adds payload length
This commit is contained in:
parent
b2296079f1
commit
af6b3c97ad
1 changed files with 3 additions and 2 deletions
5
index.js
5
index.js
|
|
@ -49,9 +49,10 @@ mqtt.on('unsubscribed', function(topic, client) {
|
|||
mqtt.on('published', function(packet, client) {
|
||||
|
||||
if(! client) return;
|
||||
|
||||
packet.payload = JSON.stringify(packet.payload);
|
||||
|
||||
packet.payloadString = packet.payload.toString();
|
||||
packet.payloadLength = packet.payload.length;
|
||||
packet.payload = JSON.stringify(packet.payload);
|
||||
packet.timestamp = new Date();
|
||||
db.insert(packet);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue