Update 55-dweetio.js

This commit is contained in:
Dave Conway-Jones 2014-08-07 09:52:16 +01:00
parent cef9e093e2
commit 7545515b4d
1 changed files with 6 additions and 2 deletions

View File

@ -29,7 +29,7 @@ module.exports = function(RED) {
//if (typeof(msg.payload) === 'object') {
var thing = node.thing || msg.thing;
try {
dweetio.dweet_for(thing, {some:msg.payload}, function(err, dweet) {
dweetio.dweet_for(thing, {payload:msg.payload}, function(err, dweet) {
//console.log(dweet.thing); // "my-thing"
//console.log(dweet.content); // The content of the dweet
//console.log(dweet.created); // The create date of the dweet
@ -52,7 +52,11 @@ module.exports = function(RED) {
dweetio.listen_for(node.thing, function(dweet){
// This will be called anytime there is a new dweet for my-thing
dweet.payload = dweet.content.some;
if (dweet.content.hasOwnProperty("payload")) {
dweet.payload=dweet.content.payload;
} else {
dweet.payload = dweet.content;
}
delete dweet.content;
node.send(dweet);
});