I’m looking Message Manager library documentation again in the hope that things are a little clearer to me. The part that still has me baffled is the MessageManager.DataMessage object which gets returned when you use the MessageManager.send() method. I don’t understand how to use this as no examples given, in particular how to apply the various handlers, such as MessageManager.DataMessage.onAck();
So am I correct in understanding that a callback handler for MessageManager.onAck(function(msg) { … })
, for example, will apply to all send messages used in the code, and then if I want to make customised onAck() relevant to a particular send event I would use something like
// assuming all configured correctly as per library example...
local mm = MessageManager();
// Then assume for agent we have
local msgEvent = mm.send("lights", true); // turn on the lights
// Now I'll have a Datamessage object linked to msgEvent. So can now do something like
msgEvent.DataMessage.onAck(function(msg) { ... });