public function initWebSocketServer()
    {
        $webSocketServer = $this->getWebSocketServer();

        $webSocketServer->setLogger(
            $this->getLogger()
        );

        if ($this->getNodeClass() !== null) {
            $webSocketServer->getConnection()->setNodeName(
                $this->getNodeClass()
            );
        }

        $socket = $webSocketServer->getConnection()->getSocket();

        $this->getLogger()->log('<fg=yellow>Starting server...</fg=yellow>');
        $this->getLogger()->log('Environment: <fg=green>%s</fg=green>', $this->kernelEnvironment);
        $this->getLogger()->log('Class used:');
        $this->getLogger()->log('  Logger           : %s', get_class($this->getLogger()));
        $this->getLogger()->log('  Runner           : %s', get_class($this));
        $this->getLogger()->log('  WebSocket Server : %s', get_class($webSocketServer));
        $this->getLogger()->log('  Socket Server    : %s', get_class($socket));
        $this->getLogger()->log('  Node             : %s', ltrim($webSocketServer->getConnection()->getNodeName(), '\\'));

        $this->getLogger()->log(
            '<fg=yellow>Listening on %s:%d</fg=yellow>',
            $socket->getAddress(),
            $socket->getPort()
        );

        $webSocketServer->on('open', xcallable($this, 'onOpen'));
        $webSocketServer->on('message', xcallable($this, 'onMessage'));
        $webSocketServer->on('binary-message', xcallable($this, 'onBinaryMessage'));
        $webSocketServer->on('ping', xcallable($this, 'onPing'));
        $webSocketServer->on('error', xcallable($this, 'onError'));
        $webSocketServer->on('close', xcallable($this, 'onClose'));

        $this->loadEvents();

        return $webSocketServer;
    }