Skip to content

Data Connectors

Name Input Params Return Data Description
resiot_dc_push String, String, String String

resiot_dc_push(String, String, String)

ResIOT allows you to push custom data over your pusher connectors. Unless you know what you're doing, you should avoid using this function as ResIOT takes care of pushing node transmissions and gateway data to your connectors automatically.
Please notice currently, you can push custom data only to Mosquitto servers, Http pushers, Websockets and Amazon AWS IOT. There is no support for Microsoft Azure yet.
Finally, as the nature of the connectors is different, the "Topic" field is required for Mosquitto connectors (mqtt, Amazon AWS IOT), and has to be omitted for those connectors where no topic is needed (Websockets, HTTP pushers).
If you're pushing a message to your public websocket, please note the data pushed will be wrapped in a JSON inside a "data" field, along with a "CommType" field with value "comm_push" and the "DT" current time<.br>

Example
AllWorked = resiot_dc_push(HexId, Topic, Payload) Input Parameters
 - HexId(string): The HexId of the Data Connector. If left empty, a CommType "comm_push" message will be sent to your public websocket connector.
 - Topic(string): The payload of the message (if needed).
 - Payload(string): The message body sent to the Data Connector.
Returns
 - Value (String): The function returns an empty string if no error occurred. If an error occurred, the string will contain a description of what went wrong.

HexId = "636f6e323732"          -- The HexId of the Data Connector. If left empty, a CommType "comm_push" message will be sent to your public websocket connector
Topic = "resiot/test"           -- The payload of the message (if needed)
Payload = '{"payload":"test"}'  -- The message body sent to the Data Connector
err = resiot_dc_push(HexId, Topic, Payload) --this works for amazon aws / mqtt pushers, fails for http pushers as no topic is required
resiot_debug(err) --if the string is not empty, a description of the error will be printed

err = resiot_dc_push(HexId, Payload) -- this works for http pushers, and returns an error for mqtt connecotrs
resiot_debug(err) --if the string is not empty, a description of the error will be printed

Return to index