Phoenix.Push.StartTimeout C# (CSharp) Method

StartTimeout() private method

private StartTimeout ( ) : void
return void
    internal void StartTimeout()
    {
      if (_timeoutTimer.Enabled) return; //jfis - dont do if timer running

      _ref = _channel.Socket.MakeRef(); //jfis - get new ref
      _refEvent = _channel.ReplyEventName(_ref); //jfis - ref as string

      _channel.On(_refEvent, (payload, _) => //make binding for refEvent
        {
          CancelRefEvent();
          CancelTimeout();
          var json = (JObject)payload;
          _receivedResp = json;

          MatchReceive(json);
        });

      _timeoutTimer.Interval = _timeout;
      _timeoutTimer.Start(); //start timeout timer, which triggers "timeout"
    }

Usage Example

コード例 #1
0
        public Push Push(string event_, JObject payload, int timeout)
        {
            if (!_joinedOnce) //jfis - necessary?
            {
                throw new Exception($"tried to push '{event_}' to '{_topic}' before joining. Use channel.join() before pushing events");
            }

            var pushEvent = new Push(this, event_, payload, timeout);

            if (CanPush())
            {
                pushEvent.Send(); //jfis - send now if can
            }
            else
            {
                pushEvent.StartTimeout(); //jfis - if cant add to buffer, but what does start timeout do?
                _pushBuffer.Add(pushEvent);
            }

            return(pushEvent);
        }
All Usage Examples Of Phoenix.Push::StartTimeout