public void SendLocalIceCandidate(IceCandidate _candidate)
        {
            executor.Execute(async() =>
            {
                var json = SignalingMessage.CreateJson(_candidate);
                if (isInitiator)
                {
                    if (App.HubConnection.State != HubConnectionState.Connected)//(State != ConnectionState.Connected)
                    {
                        ReportError("Sending ICE candidate in non connected state.");
                        return;
                    }

                    //SendPostMessage(MessageType.Message, _messageUrl, json);
                    //TODO: SignalR Send LocalIceCandidate as  Initiator
                    var isIceSent = await App.HubConnection.InvokeAsync <string>("SendLocalIceCandidate", App.HubConnection.ConnectionId, json);
                    logger.Info(TAG, $"{isIceSent}");
                }
                else
                {
                    //_wsClient.Send(json);
                    //TODO: SignalR Send LocalIceCandidate as  Participant
                    var isIceSent = await App.HubConnection.InvokeAsync <string>("SendLocalIceCandidate", App.HubConnection.ConnectionId, json);
                    logger.Info(TAG, $"{isIceSent}");
                }
            });
        }
        public void SendOfferSdp(SessionDescription _sessionDescriotion)
        {
            executor.Execute(async() =>
            {
                if (App.HubConnection.State != HubConnectionState.Connected)//(State != ConnectionState.Connected)
                {
                    ReportError("Sending offer SDP in non connected state.");
                    return;
                }

                var json = SignalingMessage.CreateJson(_sessionDescriotion);

                //SendPostMessage(MessageType.Message, messageUrl, json);
                //TODO : SignalR SDPOffer Method
                var isOfferSent = await App.HubConnection.InvokeAsync <string>("SendOfferMessage", json);
                //TODO : Here, the you call a method in the SignalR Hub passing in a List of clients you want to call.

                if (roomConnectionParameters.IsLoopback)
                {
                    // In loopback mode rename this offer to answer and route it back.
                    var sdpAnswer = new SessionDescription(SdpType.Answer, _sessionDescriotion.Sdp);
                    signalingEvents.OnRemoteDescription(sdpAnswer);
                }
            });
        }
        public void SendAnswerSdp(SessionDescription _sessionDescription)
        {
            executor.Execute(async() =>
            {
                if (roomConnectionParameters.IsLoopback)
                {
                    logger.Error(TAG, "Sending answer in loopback mode.");
                    return;
                }

                var json = SignalingMessage.CreateJson(_sessionDescription);


                //_wsClient.Send(json);
                //TODO: SignalR SSPAnswer Method
                var isAnswerSent = await App.HubConnection.InvokeAsync <string>("SendAnswerMessage", json);
            });
        }
        public void SendLocalIceCandidateRemovals(IceCandidate[] _candidates)
        {
            executor.Execute(async() =>
            {
                var json = SignalingMessage.CreateJson(_candidates);

                if (isInitiator)
                {
                    if (App.HubConnection.State != HubConnectionState.Connected)//(State != ConnectionState.Connected)
                    {
                        ReportError("Sending ICE candidate removals in non connected state.");
                        return;
                    }

                    //SendPostMessage(MessageType.Message, _messageUrl, json);
                    //TODO: SignalR Send message to Remove Ice Candidates as Initiator
                    var isIceRemoved = await App.HubConnection.InvokeAsync <string>("RemoveIceCandidates", json);
                    logger.Info(TAG, $"{isIceRemoved}");
                    if (roomConnectionParameters.IsLoopback)
                    {
                        signalingEvents.OnRemoteIceCandidatesRemoved(_candidates);
                    }
                }
                else
                {
                    //_wsClient.Send(json);
                    //TODO: SignalR Send message to Remove Ice Candidates as Participant
                    var isIceRemoved = await App.HubConnection.InvokeAsync <string>("RemoveIceCandidates", json);
                    logger.Info(TAG, $"{isIceRemoved}");
                    if (roomConnectionParameters.IsLoopback)
                    {
                        signalingEvents.OnRemoteIceCandidatesRemoved(_candidates);
                    }
                }
            });
        }