public function waitChannel($channelId)
    {
        while (true) {
            list($frameType, $frameChannel, $payload) = $this->waitFrame();
            if ($frameChannel == $channelId) {
                return array($frameType, $payload);
            }
            /**
             * Not the channel we were looking for.  Queue this frame
             * for later, when the other channel is looking for frames.
             */
            array_push(
                $this->channels[$frameChannel]->frame_queue,
                array($frameType, $payload)
            );

            /**
             * If we just queued up a method for channel 0 (the Connection
             * itself) it's probably a close method in reaction to some
             * error, so deal with it right away.
             */
            if (($frameType == 1) && ($frameChannel == 0)) {
                $this->wait();
            }
        }
        return array();
    }
public function waitChannel($channelId)
    {
        while (true) {
            list($frameType, $frameChannel, $payload) = $this->waitFrame();
            if ($frameChannel == $channelId) {
                return array($frameType, $payload);
            }
            /**
             * Not the channel we were looking for.  Queue this frame
             * for later, when the other channel is looking for frames.
             */
            array_push(
                $this->channels[$frameChannel]->frame_queue,
                array($frameType, $payload)
            );

            /**
             * If we just queued up a method for channel 0 (the Connection
             * itself) it's probably a close method in reaction to some
             * error, so deal with it right away.
             */
            if (($frameType == 1) && ($frameChannel == 0)) {
                $this->wait();
            }
        }
        return array();
    }
public function waitChannel ( $ channelId ) { while ( true ) { list ( $ frameType , $ frameChannel , $ payload ) = $ this -> waitFrame ( ) ; if ( $ frameChannel == $ channelId ) { return array ( $ frameType , $ payload ) ; } /**
             * Not the channel we were looking for.  Queue this frame
             * for later, when the other channel is looking for frames.
             */ array_push ( $ this -> channels [ $ frameChannel ] -> frame_queue , array ( $ frameType , $ payload ) ) ; /**
             * If we just queued up a method for channel 0 (the Connection
             * itself) it's probably a close method in reaction to some
             * error, so deal with it right away.
             */ if ( ( $ frameType == 1 ) && ( $ frameChannel == 0 ) ) { $ this -> wait ( ) ; } } return array ( ) ; }
Wait for a frame from the server destined for a particular channel.

@param $channelId

@return array
Wait for a frame from the server destined for a particular channel .