Skip to content

MQTTv5 client: Keep alive required to be >= 5 seconds #964

@Cadynum

Description

@Cadynum

When using v5, the keep-alive is restricted to at least 5 seconds, but I don't find any reference to this restriction in https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901045.

pub fn set_keep_alive(&mut self, duration: Duration) -> &mut Self {
assert!(duration.as_secs() >= 5, "Keep alives should be >= 5 secs");
self.keep_alive = duration;
self
}

A keep alive of 0 is also permitted in v5:

A Keep Alive value of 0 has the effect of turning off the Keep Alive mechanism. If Keep Alive is 0 the Client is not obliged to send MQTT Control Packets on any particular schedule.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions