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;