in thing/index.js [463:494]
function(err, failedTopics) {
if (!isUndefined(err) || !isUndefined(failedTopics)) {
console.warn('failed subscription to accepted/rejected topics');
return;
}
//
// If 'stateObject' is defined, publish it to the publish topic for this
// thingName+operation.
//
if (!isUndefined(stateObject)) {
//
// Add the version # (if known and versioning is enabled) and
// 'clientToken' properties to the stateObject.
//
if (!isUndefined(thingShadows[thingName].version) &&
thingShadows[thingName].enableVersioning) {
stateObject.version = thingShadows[thingName].version;
}
stateObject.clientToken = clientToken;
device.publish(publishTopic,
JSON.stringify(stateObject), {
qos: thingShadows[thingName].qos
});
if (!(isUndefined(thingShadows[thingName])) &&
thingShadows[thingName].debug === true) {
console.log('publishing \'' + JSON.stringify(stateObject) +
' on \'' + publishTopic + '\'');
}
}
});