Esempio n. 1
0
        public void SendMessage(string message)
        {
            ValidateNotDisposed();

            SignalingClient.SendMessage(_handle, message).
            ThrowIfFailed("Failed to send message to peer");
        }
Esempio n. 2
0
        public void RequestSession(int peerId)
        {
            ValidateNotDisposed();

            SignalingClient.RequestSession(_handle, peerId).
            ThrowIfFailed("Failed to request session to peer");
        }
Esempio n. 3
0
 public void Relay(RelayMessage message)
 {
     if (_signalingClient == null)
     {
         _signalingClient = _container.Resolve<SignalingClient>();
     }
     _signalingClient.Relay(message);
 }
Esempio n. 4
0
        public int GetID()
        {
            ValidateNotDisposed();

            if (!IsConnected)
            {
                throw new InvalidOperationException("Client is not connected to server yet.");
            }

            SignalingClient.GetID(_handle, out int id).
            ThrowIfFailed("Failed to get signaling client ID");

            return(id);
        }
Esempio n. 5
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed || !disposing)
            {
                return;
            }

            if (_handle != null)
            {
                SignalingClient.Disconnect(_handle);

                _isConnected = false;
                _disposed    = true;
            }
        }
Esempio n. 6
0
        public WebRTCSignalingClient(string serverIp, int port)
        {
            IntPtr zero = IntPtr.Zero;

            ValidationUtil.ValidateIsNullOrEmpty(serverIp, nameof(serverIp));

            _signalingMessageCallback = (type, message, _) =>
            {
                Log.Info(WebRTCLog.Tag, $"type:{type}, message:{message}");

                if (type == SignalingMessageType.Connected)
                {
                    _isConnected = true;
                }

                SignalingMessage?.Invoke(this, new WebRTCSignalingEventArgs(type, message));
            };

            SignalingClient.Connect(serverIp, port, _signalingMessageCallback, zero, out _handle).
            ThrowIfFailed("Failed to connect to server");
        }
Esempio n. 7
0
        public ConnectionStatus ConnectToSignalingServer(ConnectionOwner connectionOwner)
        {
            SignaledPeerData.Reset();
            SignalingStatus.Reset();
            SignaledRelayMessages.Reset();
            _streamSocket = new StreamSocket();
            _streamSocket.ConnectAsync(new HostName(SignalingSettings.SignalingServerHost),
                                       SignalingSettings.SignalingServerPort, SocketProtectionLevel.PlainSocket)
            .AsTask()
            .Wait();

            _isConnected = true;

            _signalingClient = _unityContainer.Resolve <SignalingClient>();

            StartReading();

            return(new ConnectionStatus
            {
                IsConnected = _isConnected
            });
        }
Esempio n. 8
0
 public void Relay(RelayMessage message)
 {
     SignalingClient.Relay(message);
 }
Esempio n. 9
0
 public async Task Relay(RelayMessage message)
 {
     await SignalingClient.RelayAsync(message);
 }
Esempio n. 10
0
 public ClientChannel(SignalingClient signalingClient)
 {
     _signalingClient = signalingClient;
 }