public function encode(string $data, int $type = Protocol::TYPE_TEXT, bool $masked = false)
    {
        $this->frames = [];

        $frame = $this->getFrame();
        array_push($this->frames, $frame);

        $frame->encode($data, $type, $masked);

        return $this;
    }
public function encode(string $data, int $type = Protocol::TYPE_TEXT, bool $masked = false)
    {
        $this->frames = [];

        $frame = $this->getFrame();
        array_push($this->frames, $frame);

        $frame->encode($data, $type, $masked);

        return $this;
    }
public function encode ( string $ data , int $ type = Protocol :: TYPE_TEXT , bool $ masked = false ) { $ this -> frames = [ ] ; $ frame = $ this -> getFrame ( ) ; array_push ( $ this -> frames , $ frame ) ; $ frame -> encode ( $ data , $ type , $ masked ) ; return $ this ; }
Encodes a payload

@param string  $data
@param int     $type
@param boolean $masked
@return Payload
@todo No splitting into multiple frames just yet
Encodes a payload