src/Devristo/Phpws/Protocol/WebSocketTransportHybi.php
protected function processControlFrame(WebSocketFrame $frame)
    {
        switch ($frame->getType()) {
            case WebSocketOpcode::CloseFrame :
                $this->logger->notice("Got CLOSE frame");

                $frame = WebSocketFrame::create(WebSocketOpcode::CloseFrame);
                $this->sendFrame($frame);

                $this->_socket->close();
                break;
            case WebSocketOpcode::PingFrame :
                $frame = WebSocketFrame::create(WebSocketOpcode::PongFrame, $frame->getData());
                $this->sendFrame($frame);
                break;
        }
    }
protected function processControlFrame(WebSocketFrame $frame)
    {
        switch ($frame->getType()) {
            case WebSocketOpcode::CloseFrame :
                $this->logger->notice("Got CLOSE frame");

                $frame = WebSocketFrame::create(WebSocketOpcode::CloseFrame);
                $this->sendFrame($frame);

                $this->_socket->close();
                break;
            case WebSocketOpcode::PingFrame :
                $frame = WebSocketFrame::create(WebSocketOpcode::PongFrame, $frame->getData());
                $this->sendFrame($frame);
                break;
        }
    }
protected function processControlFrame ( WebSocketFrame $ frame ) { switch ( $ frame -> getType ( ) ) { case WebSocketOpcode :: CloseFrame : $ this -> logger -> notice ( "Got CLOSE frame" ) ; $ frame = WebSocketFrame :: create ( WebSocketOpcode :: CloseFrame ) ; $ this -> sendFrame ( $ frame ) ; $ this -> _socket -> close ( ) ; break ; case WebSocketOpcode :: PingFrame : $ frame = WebSocketFrame :: create ( WebSocketOpcode :: PongFrame , $ frame -> getData ( ) ) ; $ this -> sendFrame ( $ frame ) ; break ; } }
Handle incoming control frames

Sends Pong on Ping and closes the connection after a Close request.

@param WebSocketFrame $frame
Handle incoming control frames