Net/Notifier/WebSocket/Frame.php
protected function getHeader()
    {
        $header = '';

        $fin  = $this->fin  ? 0x80 : 0x00;

        $rsv1 = $this->rsv1 ? 0x40 : 0x00;
        $rsv2 = $this->rsv2 ? 0x20 : 0x00;
        $rsv3 = $this->rsv3 ? 0x10 : 0x00;

        $byte1 = $fin | $rsv1 | $rsv2 | $rsv3 | $this->opcode;

        $mask = $this->isMasked ? 0x80 : 0x00;

        $byte2 = $mask | $this->length;

        $header .= pack('CC', $byte1, $byte2);

        if ($this->length === 0x7e) {
            $header .= pack('s', $this->length16);
        }

        if ($this->length === 0x7f) {
            // TODO
        }

        if ($this->isMasked) {
            $header .= $this->mask;
        }

        return $header;
    }
protected function getHeader()
    {
        $header = '';

        $fin  = $this->fin  ? 0x80 : 0x00;

        $rsv1 = $this->rsv1 ? 0x40 : 0x00;
        $rsv2 = $this->rsv2 ? 0x20 : 0x00;
        $rsv3 = $this->rsv3 ? 0x10 : 0x00;

        $byte1 = $fin | $rsv1 | $rsv2 | $rsv3 | $this->opcode;

        $mask = $this->isMasked ? 0x80 : 0x00;

        $byte2 = $mask | $this->length;

        $header .= pack('CC', $byte1, $byte2);

        if ($this->length === 0x7e) {
            $header .= pack('s', $this->length16);
        }

        if ($this->length === 0x7f) {
            // TODO
        }

        if ($this->isMasked) {
            $header .= $this->mask;
        }

        return $header;
    }
protected function getHeader ( ) { $ header = '' ; $ fin = $ this -> fin ? 0x80 : 0x00 ; $ rsv1 = $ this -> rsv1 ? 0x40 : 0x00 ; $ rsv2 = $ this -> rsv2 ? 0x20 : 0x00 ; $ rsv3 = $ this -> rsv3 ? 0x10 : 0x00 ; $ byte1 = $ fin | $ rsv1 | $ rsv2 | $ rsv3 | $ this -> opcode ; $ mask = $ this -> isMasked ? 0x80 : 0x00 ; $ byte2 = $ mask | $ this -> length ; $ header .= pack ( 'CC' , $ byte1 , $ byte2 ) ; if ( $ this -> length === 0x7e ) { $ header .= pack ( 's' , $ this -> length16 ) ; } if ( $ this -> length === 0x7f ) { // TODO } if ( $ this -> isMasked ) { $ header .= $ this -> mask ; } return $ header ; }
Gets this frame's header as a binary string

@return string this frame's header as a binary string.

@todo Support long lengths (length values larger than a 32-bit signed
integer.)
Gets this frame s header as a binary string