Add max-frame configuration, fix multi-frame receive
handle connection failure in example code