You can use reconnect and reconnect_delay_set to reconnect to the broker again. client.reconnect() client.reconnect_delay_set(1,30)