public function sendData(string $data, int $type = Protocol::TYPE_TEXT, $masked = true)
    {
        if (!$this->isConnected()) {
            return false;
        }

        $payload = $this->protocol->getPayload();

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

        return $payload->sendToSocket($this->socket);
    }
public function sendData(string $data, int $type = Protocol::TYPE_TEXT, $masked = true)
    {
        if (!$this->isConnected()) {
            return false;
        }

        $payload = $this->protocol->getPayload();

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

        return $payload->sendToSocket($this->socket);
    }
public function sendData ( string $ data , int $ type = Protocol :: TYPE_TEXT , $ masked = true ) { if ( ! $ this -> isConnected ( ) ) { return false ; } $ payload = $ this -> protocol -> getPayload ( ) ; $ payload -> encode ( $ data , $ type , $ masked ) ; return $ payload -> sendToSocket ( $ this -> socket ) ; }
Sends data to the socket

@param string  $data
@param int     $type See Protocol::TYPE_*
@param boolean $masked
@return bool Success
Sends data to the socket