Net/Notifier/Client.php
protected function connect()
    {
        $this->socket = new Net_Notifier_Socket_Client(
            sprintf(
                'tcp://%s:%s',
                $this->host,
                $this->port
            ),
            $this->timeout / 1000
        );

        $this->connection = new Net_Notifier_WebSocket_Connection(
            $this->socket
        );

        $this->connection->startHandshake(
            $this->host,
            $this->port,
            $this->resource,
            array(Net_Notifier_WebSocket::PROTOCOL)
        );

        // read handshake response
        $state = $this->connection->getState();
        while ($state < Net_Notifier_WebSocket_Connection::STATE_OPEN) {

            $read = array($this->socket->getRawSocket());

            $result = stream_select(
                $read,
                $write = null,
                $except = null,
                null
            );

            if ($result === 1) {
                $this->connection->read(self::READ_BUFFER_LENGTH);
            }

            $state = $this->connection->getState();
        }
    }
protected function connect()
    {
        $this->socket = new Net_Notifier_Socket_Client(
            sprintf(
                'tcp://%s:%s',
                $this->host,
                $this->port
            ),
            $this->timeout / 1000
        );

        $this->connection = new Net_Notifier_WebSocket_Connection(
            $this->socket
        );

        $this->connection->startHandshake(
            $this->host,
            $this->port,
            $this->resource,
            array(Net_Notifier_WebSocket::PROTOCOL)
        );

        // read handshake response
        $state = $this->connection->getState();
        while ($state < Net_Notifier_WebSocket_Connection::STATE_OPEN) {

            $read = array($this->socket->getRawSocket());

            $result = stream_select(
                $read,
                $write = null,
                $except = null,
                null
            );

            if ($result === 1) {
                $this->connection->read(self::READ_BUFFER_LENGTH);
            }

            $state = $this->connection->getState();
        }
    }
protected function connect ( ) { $ this -> socket = new Net_Notifier_Socket_Client ( sprintf ( 'tcp://%s:%s' , $ this -> host , $ this -> port ) , $ this -> timeout / 1000 ) ; $ this -> connection = new Net_Notifier_WebSocket_Connection ( $ this -> socket ) ; $ this -> connection -> startHandshake ( $ this -> host , $ this -> port , $ this -> resource , array ( Net_Notifier_WebSocket :: PROTOCOL ) ) ; // read handshake response $ state = $ this -> connection -> getState ( ) ; while ( $ state < Net_Notifier_WebSocket_Connection :: STATE_OPEN ) { $ read = array ( $ this -> socket -> getRawSocket ( ) ) ; $ result = stream_select ( $ read , $ write = null , $ except = null , null ) ; if ( $ result === 1 ) { $ this -> connection -> read ( self :: READ_BUFFER_LENGTH ) ; } $ state = $ this -> connection -> getState ( ) ; } }
Connects this client to the cha-ching server

A socket connection is opened and the WebSocket handshake is initiated.

@return void

@throws Net_Notifier_ClientException if there is an error connecting to
the notification server.
Connects this client to the cha - ching server