Exemplo n.º 1
0
 private void OnChannelStateChanged(object sender, ChannelStateChange e)
 {
     if (e.Current == ChannelState.Attached)
     {
         /* Start sync, if hasPresence is not set end sync immediately dropping all the current presence members */
         Map.StartSync();
         _syncAsResultOfAttach = true;
         // TODO: for v1.0 RTP19a (see Java version for example https://github.com/ably/ably-java/blob/159018c30b3ef813a9d3ca3c6bc82f51aacbbc68/lib/src/main/java/io/ably/lib/realtime/Presence.java)
         //if (!hasPresence)
         //{
         //    /*
         //     * RTP19a  If the PresenceMap has existing members when an ATTACHED message is received without a
         //     * HAS_PRESENCE flag, the client library should emit a LEAVE event for each existing member ...
         //     */
         //    endSyncAndEmitLeaves();
         //}
         SendQueuedMessages();
     }
     else if ((e.Current == ChannelState.Detached) || (e.Current == ChannelState.Failed))
     {
         FailQueuedMessages(e.Error);
         Map.Clear();
         InternalMap.Clear();
     }
 }
Exemplo n.º 2
0
 private void OnChannelStateChanged(object sender, ChannelStateChange e)
 {
     if (e.Current == ChannelState.Attached)
     {
         SendQueuedMessages();
     }
     else if ((e.Current == ChannelState.Detached) || (e.Current == ChannelState.Failed))
     {
         FailQueuedMessages(e.Error);
     }
 }
Exemplo n.º 3
0
        private void ChannelOnChannelStateChanged(object sender, ChannelStateChange args)
        {
            lock (_lock)
            {
                if (Waiting == false)
                {
                    return;
                }
            }

            if (args.Current == _awaitedState)
            {
                Complete(true);
            }
        }
Exemplo n.º 4
0
 private void ChannelOnChannelStateChanged(object sender, ChannelStateChange args)
 {
     if (args.Current == _awaitedState)
     {
         DetachListener();
         try
         {
             _waiting = false;
             _callback?.Invoke(true, null);
         }
         catch (Exception ex)
         {
             Logger.Error("Error in callback for Channel state: " + _awaitedState, ex);
         }
     }
 }
Exemplo n.º 5
0
        private void ChannelOnChannelStateChanged(object sender, ChannelStateChange args)
        {
            lock (_lock)
            {
                if (_waiting == false)
                {
                    return;
                }
            }

            if (args.Current == _awaitedState)
            {
                lock (_lock)
                {
                    _waiting = false;
                }

                InvokeCallbacks(true, null);
            }
        }