Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum message length for a MQTT broker?

Tags:

node.js

mqtt

iot

I am using the node.js mosca MQTT broker for some internet of things (iot) application.

https://github.com/mcollina/mosca

What is the maximum message length that a topic can receive for the mosca broker? What are the factors that constrain the message length?

If I want to increase the message length, is there a configuration parameter I can modify or which part of the code can I change?

like image 747
guagay_wk Avatar asked Dec 30 '15 02:12

guagay_wk


People also ask

How long can an MQTT message be?

The MQTT protocol allows messages with a maximum size of 268435455 bytes approx 260MB. This is obviously a very large message size and one that most brokers,especially public brokers, will restrict.

How many messages can MQTT handle?

MQTT broker can handle unlimited number of connections. This can be achieved by fine-tuning the server on which broker is installed. The following parameter should be consider while tuning the system: 1.

What is the maximum payload size in MQTT?

The MQTT protocol itself defines a MQTT PUBLISH payload size limit of 256MB. For a majority of the M2M and IoT scenarios this is a very high limit and most clients will probably never send a message with a payload which is that huge.

What is the range of MQTT?

MQTT is considered a lightweight protocol because all its messages have a small code footprint. Each message consists of a fixed header -- 2 bytes -- an optional variable header, a message payload that is limited to 256 megabytes (MB) of information and a quality of service (QoS) level.


1 Answers

It's not entirely clear what you're asking here, so I'll answer both possibilities.

The length of the actual topic string is at most 65536 bytes. This is a limit imposed by the mqtt spec, you can't change it. It is also worth noting that the topic is encoded with utf-8, so you may have less than 65536 characters available.

The payload of the message is limited to 268,435,456 bytes. Again, this is defined by the spec.

If you are routinely approaching either of these limits you should be thinking about whether what you are doing is sensible.

like image 151
ralight Avatar answered Oct 17 '22 03:10

ralight