コード例 #1
0
        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            Ortc.Setup();
            Settings.ApplyDefaults();

            var name = GetLocalPeerName();

            Debug.WriteLine($"Connecting to server from local peer: {name}");

            _signaler = new TcpSignaler("my.signaling.server.ip", "8888", name);

            _signaler.Connected        += Signaler_Connected;
            _signaler.ConnectionFailed += Signaler_ConnectionFailed;
            _signaler.PeerConnected    += Signaler_PeerConnected;
            _signaler.PeerMessage      += Signaler_MessageFromPeer;

            // It's important to run the below asynchronously for now as it blocks the current thread while waiting for socket data.
            Task.Run(() =>
            {
                _signaler.Connect();
            });
        }