Implement the heartbeat procedure.