Ubidots Community

Ubidots-esp32 library and iot protocol choice

if one does not specify an Iot protocol when instancing ubidots (ubidots.h library), does it default to http, tcp ?

I was studying the examples.

In the send with timestamp example we have

Ubidots ubidots(UBIDOTS_TOKEN);

In the send with HTTP we get.

Ubidots ubidots(UBIDOTS_TOKEN, UBI_HTTP);

Also, is there and advantage to use TCP over HTTP when using send or get

Ubidots ubidots(UBIDOTS_TOKEN, UBI_TCP);
Ubidots ubidots(UBIDOTS_TOKEN, UBI_HTTP);

My use case is sending weather sensor data to ubidots hourly, deep sleep between readings.

Sorry for the noob questions.


Greetings @micromet I hope you are doing great.

Regarding the default protocol, the Ubidots class uses TCP protocol by default if not specified in the arguments.

An instantiation like:
Ubidots ubidots(UBIDOTS_TOKEN);

Will cause the ubidots object to use TCP protocol by default, as if it had been instantiated like Ubidots ubidots(UBIDOTS_TOKEN, UBI_TCP);

Now, about which protocol is better to use, it highly depends on the hardware that you are using and your requirements as user, however, something I have noted sometimes, is that when using TCP, sending the data is a bit faster than HTTP.

Please reach back to us if you encounter any other doubt.

Best regards
–Juan David