Communication Between Controllers
Using messageIn and messageOut
messageIn and messageOutconst my_id = '12345678';
const target_id = '87654321';
const scheduler = ServiceHandler.scheduler;
scheduler.messageIn.connect((from, to, json) => {
// filter out unwanted messages
if (to != my_id) return;
console.log('messageIn received');
console.log({
from,
to,
data: JSON.parse(json),
});
});
scheduler.messageOut(
my_id,
target_id,
{
hello: 'world',
list: [1, 2, 3],
nested: { level: { deep: 0 } },
},
(e) => console.log((e === `Sent to receiver`) ? 'success!' : 'failed to send');
);Using Targeted Commands
Sending
Receiving
Targeted Command Payload Restrictions
Last updated