examples/tcp_proxy_example.php
public function onMessage(WebSocketTransportInterface $user, WebSocketMessageInterface $msg)
    {
        try {
            $message = json_decode($msg->getData());

            if ($message->command == 'connect')
                $this->requestConnect($user, $message);
            elseif ($message->command == 'write')
                $this->requestWrite($user, $message);
            elseif ($message->command == 'close')
                $this->requestClose($user, $message);

        } catch (Exception $e) {
            $this->logger->err($e->getMessage());
        }
    }
public function onMessage(WebSocketTransportInterface $user, WebSocketMessageInterface $msg)
    {
        try {
            $message = json_decode($msg->getData());

            if ($message->command == 'connect')
                $this->requestConnect($user, $message);
            elseif ($message->command == 'write')
                $this->requestWrite($user, $message);
            elseif ($message->command == 'close')
                $this->requestClose($user, $message);

        } catch (Exception $e) {
            $this->logger->err($e->getMessage());
        }
    }
public function onMessage ( WebSocketTransportInterface $ user , WebSocketMessageInterface $ msg ) { try { $ message = json_decode ( $ msg -> getData ( ) ) ; if ( $ message -> command == 'connect' ) $ this -> requestConnect ( $ user , $ message ) ; elseif ( $ message -> command == 'write' ) $ this -> requestWrite ( $ user , $ message ) ; elseif ( $ message -> command == 'close' ) $ this -> requestClose ( $ user , $ message ) ; } catch ( Exception $ e ) { $ this -> logger -> err ( $ e -> getMessage ( ) ) ; } }
Entry point for all messages received from clients in this proxy 'room'

@param WebSocketTransportInterface $user
@param WebSocketMessageInterface $msg
Entry point for all messages received from clients in this proxy room