Exemple #1
0
        public Push(Channel channel, string event_, JObject payload)
        {
            _channel = channel;
            _event   = event_;
            _payload = payload;

            _receivedResp = null;
            _afterHook    = null;
            _recHooks     = new List <RecHook>();
            _sent         = false;
        }
Exemple #2
0
        public Push(Channel channel, string event_, JObject payload)
        {
            _channel = channel;
            _event = event_;
            _payload = payload;

            _receivedResp = null;
            _afterHook = null;
            _recHooks = new List<RecHook>();
            _sent = false;
        }
Exemple #3
0
        public Push After(int timeoutMs, Action callback)
        {
            if (_afterHook != null)
            {
                //throw
                throw new Exception("only a single after hook can be applied to a push");
            }

            var timer = new Timer(timeoutMs);
            if (_sent)
            {
                timer.Elapsed += (o, e) => callback();
                timer.AutoReset = false;
                timer.Start();//.Enabled = true;
            }

            _afterHook = new AfterHook{ Ms = timeoutMs, Callback = callback, Timer = timer };

            return this;
        }
Exemple #4
0
        public Push After(int timeoutMs, Action callback)
        {
            if (_afterHook != null)
            {
                //throw
                throw new Exception("only a single after hook can be applied to a push");
            }

            var timer = new Timer(timeoutMs);

            if (_sent)
            {
                timer.Elapsed  += (o, e) => callback();
                timer.AutoReset = false;
                timer.Start();//.Enabled = true;
            }

            _afterHook = new AfterHook {
                Ms = timeoutMs, Callback = callback, Timer = timer
            };

            return(this);
        }