public function register(LoopInterface $loop, $port, $host = '127.0.0.1', array $cert = [])
    {
        $socket = new SocketServer("{$host}:{$port}", $loop);

        if (count($cert) > 0) {
            $socket = new SecureSocketServer($socket, $loop, $cert);
        }

        $http = new HttpServer($socket);
        $http->on('request', $this->app);
        
        echo("Server running on {$host}:{$port}\n");
        $loop->run();
    }