Is there a common standard/practice for having an IOT device establish a connection to a command and control server, and then act in a server role (i.e. the C&C sends requests to the device and the device sends back responses)? Something in the vein of reverse HTTP or RPC.

EDIT: an example use case: The device is behind a NAT gateway and the C&C is unable to initiate a connection to it. We want to send a "ping" message the device (to see if it's on and healthy or something) and receive a "pong" in reply.

  • 1
    Maybe give us an example of what you're trying to do and we can help you a bit better then. – Helmar Nov 9 at 22:50
up vote 1 down vote accepted

Most of the major provider of mass IoT services (AWS, Microsoft, IBM) seem to have settled on MQTT.

The MQTT broker runs in the cloud and the devices connect out the broker (this gets round the NAT problem) and then subscribes to topics on which messages are published. Topics can be general or specific to the device/client.

The protocol also has a built in keep alive checking to determine if the device is still working and the broker can publish a special message (Last Will & Testament) if the device goes offline unexpectedly.

  • I've been looking at MQTT, is there a protocol on top of it or any way that it can be used to do a request-response transaction with the device? – kag0 Nov 12 at 17:33
  • MQTT is a raw transport, you can layer what you want on top. With the new MQTT v5 standard there is the option to mark a message as the reply to a previous message in the header. – hardillb Nov 12 at 17:41
  • Yeah I was asking if there were any layers on top that are particularly popular. That reply header in v5 sounds really promising though, thanks for that. – kag0 Nov 12 at 17:43
  • Haha, subtle. I'm looking into the v5 reply functionality to ensure it will fit my need for transnational behavior, but rest assured I will mark your answer if it works. – kag0 Nov 12 at 18:12
  • For anyone who comes looking for this, the request-response behavior in v5 is outlined here docs.oasis-open.org/mqtt/mqtt/v5.0/cs02/…, but could easily be implemented in a lower version of the standard by an application. – kag0 Nov 12 at 18:36

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.