void init(String UUID, String ChannelName, int Heartbeat, void(*messageReceived)(String message));
Used to define the connection parameters. Call this methid within arduino setup procedure.
- UUID, a unique identifier across all arduino connected to the same channel id.
- channelName, local channel id.
- HeartBeat, Timeout. Used to check the health of a connection.
- messageReceived, a function callback triggered whenever a new message arrives.
Used to keep the connection openned and ready for new messages. You have to call this method once within arduino loop procedure.
Return the current state of the background connection to the remote server. (DISCONNECTED, CONNECTING, CONNECTED, WAITING, SUBSCRIBING, SUBSCRIBED, SENDING, SENT, DISCONNECTING, STOP)
int sendMessage(String DestinationId, String Body, String Correlationid)
Used to send messages to a remote device using it’s channel id
- DestinationId, channel id of the remote device you want to send a message.
- Body, message as a XML/JSON or as a plain text.
- Correlationid, used to keep track about the messages sent/received. If you want to use a challenge/response approach you can associate the challenge sent message with a correlation id, once a message is received you can use its correlation id to identify the associated challenge message.