public void SendMessage(string message) { ValidateNotDisposed(); SignalingClient.SendMessage(_handle, message). ThrowIfFailed("Failed to send message to peer"); }
public void RequestSession(int peerId) { ValidateNotDisposed(); SignalingClient.RequestSession(_handle, peerId). ThrowIfFailed("Failed to request session to peer"); }
public void Relay(RelayMessage message) { if (_signalingClient == null) { _signalingClient = _container.Resolve<SignalingClient>(); } _signalingClient.Relay(message); }
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); }
protected virtual void Dispose(bool disposing) { if (_disposed || !disposing) { return; } if (_handle != null) { SignalingClient.Disconnect(_handle); _isConnected = false; _disposed = true; } }
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"); }
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 }); }
public void Relay(RelayMessage message) { SignalingClient.Relay(message); }
public async Task Relay(RelayMessage message) { await SignalingClient.RelayAsync(message); }
public ClientChannel(SignalingClient signalingClient) { _signalingClient = signalingClient; }