Trigger() private méthode

private Trigger ( string status, Newtonsoft.Json.Linq.JObject response ) : void
status string
response Newtonsoft.Json.Linq.JObject
Résultat void
Exemple #1
0
        public Push Leave(TimeSpan?timeout = null)
        {
            _rejoinTimer?.Reset();
            _joinPush.CancelTimeout();

            State = ChannelState.Leaving;

            void TriggerClose()
            {
                if (Socket.HasLogger())
                {
                    Socket.Log(LogLevel.Debug, "channel", $"leave {Topic}");
                }

                Trigger(Message.InBoundEvent.Close);
            }

            var leaveEvent = Message.OutBoundEvent.Leave.Serialized();
            var leavePush  = new Push(this, leaveEvent, null, timeout ?? _timeout);

            leavePush
            .Receive(ReplyStatus.Ok, _ => TriggerClose())
            .Receive(ReplyStatus.Timeout, _ => TriggerClose());
            leavePush.Send();

            if (!CanPush())
            {
                leavePush.Trigger(ReplyStatus.Ok);
            }

            return(leavePush);
        }
Exemple #2
0
        public Push Leave(int timeout)
        {
            Action onClose = () =>
            {
                _socket.Log("channel", $"leave ${_topic}"); //jfis - seems odd to tie logs to socket

                Trigger(Phoenix.CHANNEL_EVENT_CLOSE);       //, "leave");
            };

            var leavePush = new Push(this, Phoenix.CHANNEL_EVENT_LEAVE, Phoenix.EMPTY_JS_OBJECT, timeout);

            leavePush
            .Receive("ok", (_) => onClose())
            .Receive("timeout", (_) => onClose());
            leavePush.Send();

            if (!CanPush()) //jfis - if cant push simulate ok
            {
                leavePush.Trigger("ok", Phoenix.EMPTY_JS_OBJECT);
            }

            return(leavePush);
        }
Exemple #3
0
    public Push Leave(int timeout)
    {
      Action onClose = () =>
        {
          _socket.Log("channel", $"leave ${_topic}"); //jfis - seems odd to tie logs to socket

          Trigger(Phoenix.CHANNEL_EVENT_CLOSE);//, "leave");
        };

      var leavePush = new Push(this, Phoenix.CHANNEL_EVENT_LEAVE, Phoenix.EMPTY_JS_OBJECT, timeout);
      leavePush
        .Receive("ok", (_) => onClose())
        .Receive("timeout", (_) => onClose());
      leavePush.Send();

      if (!CanPush()) //jfis - if cant push simulate ok
      {
        leavePush.Trigger("ok", Phoenix.EMPTY_JS_OBJECT);
      }

      return leavePush;
    }