05-01-2018 08:19
05-01-2018 08:19
I can't seem to get a message to send when the Companion wakes up.
The following code in my Companion always results in: 'messaging not open'
How can I open the messaging on wokenUp?
if (me.launchReasons.wokenUp) {
console.log("Started due to wake interval!");
sendWakeMessage();
}
function sendWakeMessage() {
if (messaging.peerSocket.readyState === messaging.peerSocket.OPEN) {
var data = {
message: "wake"
}
messaging.peerSocket.send(data);
console.log("Message sent from companion");
} else {
console.log("messaging not open");
}
}
I also tried putting
messaging.peerSocket.onopen = function() {
sendWakeMessage();
}
inside the wokenUp handler, with no luck
05-14-2018 22:22
05-14-2018 22:22
bump.
does anyone have a solution to this?
is it even possible to communicate or start the app from companion wake?
05-14-2018 23:40
05-14-2018 23:40
Apps do not work in background, so if your app is off, then you can't communicate with it.
There is a feature suggestion combining background processing with app-originated notifications:
Feel free to vote on it.