Agent.send return value


I have some data stored in a database at my hosting server, and the device needs the data to make some calculations, if I run agent.send on the device, is there any way to get a return value from the agent back to the device?

Thank you for any advise.

Sure. The function you register with device.on() in the agent code - this is needed to receive the message sent by agent.send() - can subsequently call device.send() to fire off a message and data to the imp. The device code will need to implement agent.on() to receive and process the data coming from the agent.

See The interactive imp:

Oh I see, that’s makes sense.