Protocols

MQTT

MQTT excels in securely transferring data in comparision to protocols like HTTP.   It is easy and lightweight to implement on the client side.   MQTT is an approved OASIS Standard.  

Every MQTT client has a unique client identifier of up to 65535 characters (common practice is to use a 36 character Universal Unique Identifier UUID), or other unique identifier such as the MAC address of the network module that can be used for client authentication.   Another possible client authentication method is using a X.509 client certification.  

MQTT has a quality of service (QoS) feature.   QoS0 messages don't have an acknowledgement from the broker (but still has ack from TCP layer).   QoS1 messages are guaranteed to be delivered, but they may be delivered multiple times (the receipient can use the Packet Identifier to identify duplicates).   QoS2 messages are guaranteed to be delivered exactly once, and they have the maximum overhead.  

MQTT usually works on top of TCP/IP. The data overhead for any TCP packet is 40 bytes.   MQTT can be sent over TLS (known as "MQTT over TLS") and each message is the same size as TCP, except for the first TLS handshake.   Every TCP data packet sent caused an acknowledgement packet to be received with a size of about 40 bytes from the receipient.   The MQTT overhead is 9 bytes.   The payload size in bytes for a UTF-8 encoded string is the number of characters of the string.   Sending 46 signed floating point numbers with six significant digits (+6.534755E+06) as MQTT over TLS will have a total size of 40 (TCP) + 40 (TCP ack) + 9 + 46*14 (+6.534755E+06;+6.534755E+06;..) = 693 bytes.  

Use a keep alive time of between 3 minutes to 6 minutes.   The special MQTT keep alive message size is unknown, but assume it to be about 94 bytes.  

Hosted MQTT Broker

For testing, try mosquitto MQTT

Use HiveMQ Cloud to connect up to 100 MQTT client devices at no cost to you.

InfluxDB Cloud Free Plan up to 5 MB / 5 minutes.   As of Aug 2020, they support a new native MQTT collector.  

MyQttHub.com 'Open' plan is free for up to 300 messages/minute.  

Public MQTT 5 Broker   FREE.   Not for production.  

CloudMQTT $299/mo for up to 10k connections.  

 

HTTP

 


Do you need help developing or customizing a IoT product for your needs?   Send me an email requesting a free one hour phone / web share consultation.  

 

The information presented on this website is for the author's use only.   Use of this information by anyone other than the author is offered as guidelines and non-professional advice only.   No liability is assumed by the author or this web site.