Start a new topic

Inform the client if my app cannot process a Point to Point message due to an error.

I am using point to point message on one of my IoT device. My app sends a point to point message to the Client and the Client responds back with a Reply. On receiving the reply my App does some background processing. This works fine but i want to inform the Client of the processing failing with an error message.


You can do this by sending a error json in the reply message payload and setting status to 0.

    

POST /api/beta/tenants/57352d50-9cb3-11e5-b6ff-404014d5dd81/clients/7a7316b0-9cb3-11e5-b6ff-404014d5dd81/messages
{
   "id":1000,
   "type":"p2p",
   "payload": {
               "error_code": 1,
               "error_msg": "The server timed out while processing message.",
   },
   "qos":1,
   "duplicate":0,
   "save":1,
   "status":0
}

    

You can agree to a set of error_code and error_msg between your client app and your IoT app. These error code and error message would be part of the Result object passed to your pointToPointMessageHandler.




1 person likes this

Thanks its working now.

Login or Signup to post a comment