Skip to main content

Connection

Birth and Last Will:#

When an agent is connected for the first time it responds with two acknowledgement messages one acknowledging the connection establishment (BirthJSON/CONNECTED ack) and the next acknowledging the subscription (SUBSCRIBED ack) to the topic,only if the agent supports two way communication.

On the abrupt disconnection of the agent from the facilio mqtt broker, the broker DISCONNECTED ack/LastWillMessage.

The last will message will be set during the connection establishment itself.

Status codes

ConnectionStatus Codes
CONNECTION_LOST0
CONNECTED1
SUBSCRIBED2
DISCONNECTED3
CONNECTION_ACTIVE4

Sample Birth Message

{  "agent": "agent-name",  "status": 1,  "publishType": 2}

Sample Subscribtion Success Message

{  "agent": "agent-name",  "status": 2,  "publishType": 2}

Sample Last Will Message

{  "agent": "agent-name",  "status": 0,  "publishType": 2}