Esempio n. 1
0
        // This method is called when the user has finished editing the Room ID InputField.
        async void ConnectToServerWithRoomId(string roomId)
        {
            if (roomId == "")
            {
                clog("You must enter a room ID. Please try again.");
                return;
            }
            Uri edgeCloudletUri = null;

            clog("Connecting to WebSocket Server with roomId=" + roomId + "...");
            clog("useAltServer=" + useAltServer + " host=" + host + " edgeCloudletStr=" + edgeCloudletStr);
            queryParams = "?roomid=" + roomId;
            if (useAltServer)
            {
                server          = "ws://" + host + ":" + port;
                edgeCloudletUri = new Uri(server + queryParams);
                await client.Connect(edgeCloudletUri);

                netTest.sites.Enqueue(new NetTest.HostAndPort {
                    host = host, port = port
                });
            }
            else
            {
                if (edgeCloudletStr == "")
                {
                    clog("No edgeCloudletUri received yet. Please try again.");
                    return;
                }
                edgeCloudletUri = new Uri("ws://" + edgeCloudletStr + queryParams);
                await client.Connect(edgeCloudletUri);
            }
            clog("Connection to " + edgeCloudletUri + " status: " + client.isOpen());
        }
Esempio n. 2
0
        // This method is called when the user has finished editing the Room ID InputField.
        async void ConnectToServerWithRoomId(string roomId)
        {
            Uri edgeCloudletUri;

            if (roomId == "")
            {
                clog("You must enter a room ID. Please try again.");
                return;
            }

            clog("Connecting to WebSocket Server with roomId=" + roomId + "...");
            clog("useAltServer=" + useAltServer + " host=" + host + " edgeCloudletStr=" + edgeCloudletStr);
            queryParams = "?roomid=" + roomId;

            if (client.isOpen())
            {
                client.Dispose();
                client = new WsClient(integration);
            }

            if (useAltServer)
            {
                server          = "ws://" + host + ":" + port;
                edgeCloudletUri = new Uri(server + queryParams);
                await client.Connect(edgeCloudletUri);
            }
            else
            {
                await client.Connect(queryParams);
            }
            clog("Connection to status: " + client.isOpen());
        }