keepalive of MQTT
doc
paho mqtt client sample code
server side mqtt keepalive done