The mqtt documentation explains that the maximum value of the keepalive is 18 hours 12 minutes and 15 seconds.
But the mosquitto server disconnects the clients if it does not receive messages before 60 seconds plus a tolerance of 30 seconds that is to say maximum to 90 seconds.
That is, I can not configure a keepalive more than 90 seconds.
You do not configure the keep alive on the broker, it is configured on the client side.
The value is pass in the connect packet from the client to the broker (http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Keep_Alive)
How you configure this will depend on which client library you are using, but most libraries take it as a configuration option.
E.g. for libmosquitto you pass the keep alive value in seconds to the mosquitto_connect
function (https://mosquitto.org/man/libmosquitto-3.html#idm46181896216640)
int mosquitto_connect( mosq,
host,
port,
keepalive);
struct mosquitto *mosq;
const char *host;
int port;
Also you normally will not have to publish a message, the client library should send ping packets if no messages have been sent/received in the keep alive period in order to keep the connection alive. int keepalive;