Skip to content

Server can define its own Keep Alive in CONNACK #789

@andsel

Description

@andsel

Allow the Server to specify the value it wishes the Client to use as a keep alive. This allows the Server to set a maximum allowed keepalive and still have the Client honor it.

MQTT5 specification

If the Server sends a Server Keep Alive on the CONNACK packet, the Client MUST use this value instead 
of the Keep Alive value the Client sent on CONNECT [MQTT-3.2.2-21]. If the Server does not send 
the Server Keep Alive, the Server MUST use the Keep Alive value set by the Client on CONNECT [MQTT-3.2.2-22]

Implementation notes

The server could be configured, through its config/moquette.conf file, to use a predefined keep alive value (in seconds), to override the one that the clients would transmit. This value is sent back to the the client as Server Keep Alive property in CONNACK.

The name of the setting to be used in the config file is server_keep_alive and could be expressed as a duration.
Examples:

server_keep_alive 10s

or

server_keep_alive 2m

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions