Question regarding MQTT communication in MQTT nodes

Hello, I'm wondering if someone knows if there is any generic (lower level) background communication ongoing in MQTT while the client is just connected to the broker and subscribes to topics? And if the node red MQTT nodes eventually adds such things for any reasons?

Why I'm asking is because I plan to use MQTT in a project where the connection between clients and the broker is provided by a 4G gateway so best is of course if no data consumption happens unless some real data is sent or received either way

This is a good article on the subject:

2 Likes

There is a keep alive ping/pong message exchange that happens in the background. This is about 4 bytes of data in each direction at an interval you can choose through the 'keep alive' setting in the mqtt broker configuration node.

If we're being pedantic, the keep alive interval determines how long the broker will wait for any data from a client before considering the client is dead and should be disconnected. Most brokers offer a 1.5x grace period. Clients will typically send pings (if needed) at something under the keepalive period to ensure they don't get unexpectedly disconnected.

4 Likes

Perfect, thank you both!

Best regards, Walter

If you're being super-pedantic :sunglasses: - it's 4 bytes of keepalive data - which is wrapped in a TCP packet so about 70 bytes one way and 66 bytes tcp ack back.

3 Likes