public function onConnect(WebSocketTransportInterface $transport){
        /**
         * @var $stackTransport StackTransport
         * @var $jsonTransport RemoteEventTransport
         */
        $logger = $this->logger;
        $loop = $this->loop;
        $stackTransport = StackTransport::create($transport, array(function(TransportInterface $carrier) use($loop, $logger){
            return new RemoteEventTransport($carrier, $loop, $logger);
        }));

        $jsonTransport = $stackTransport->getTopTransport();

        $server = $transport->getHandshakeResponse()->getHeaders()->get('X-WebSocket-Server')->getFieldValue();

        $greetingMessage = RemoteEventMessage::create(null, "greeting", "hello world from $server!");

        $jsonTransport->whenResponseTo($greetingMessage, 0.1)->then(function(RemoteEventMessage $result) use ($logger, $server){
            $logger->notice(sprintf("Got '%s' in response to 'hello world from $server!'", $result->getData()));
        });

        $jsonTransport->remoteEvent()->on("greeting", function(RemoteEventMessage $message) use ($transport, $logger){
            $logger->notice(sprintf("We got a greeting event from {$transport->getId()}"));
        });
    }