public function load($buffer){
        $this->fin = ord($buffer[0]) >> 7;
        $this->opcode = ord($buffer[0]) & (pow(2,4)-1);
        $this->mask = ord($buffer[1]) >> 7;
        if($this->isCtlFrame()) return ;
        
        $this->payload_len = ord($buffer[1]) & 127;
        
        $ext_bytes = 0;
        if($this->payload_len < 126) {
            $this->payload_ext_len = 0;
        }elseif($this->payload_len === 126 ) {
            $this->payload_ext_len = unpack('n', substr($buffer,2,2));
            $ext_bytes=2;
        }else if($this->payload_len === 127) {
            $this->payload_ext_len = unpack('J', substr($buffer,2,8));
            $ext_bytes=8;
        }        
        
        if($this->mask) {
            $this->mask_key = substr($buffer, $ext_bytes+2, 4);
            $data = substr($buffer, $ext_bytes+6);
            for ($index = 0; $index < strlen($data); $index++) {
                $this->body .= $data[$index] ^ $this->mask_key[$index % 4];
            }
            
        }else{
            $this->mask_key = '';
            $this->body = substr($buffer, $ext_bytes+2);
        }
    }