public void Test()
        {
            var json = @"{
                sid: 'nne323',
                upgrades: ['u1','u2'],
                pingInterval: 12,
                pingTimeout: 23
            }";

            var handshakeData = new HandshakeData(json);
            Assert.Equal("u1", handshakeData.Upgrades[0]);
            Assert.Equal("u2", handshakeData.Upgrades[1]);

            Assert.Equal(12, handshakeData.PingInterval);
            Assert.Equal(23, handshakeData.PingTimeout);

        }
        private void OnHandshake(HandshakeData handshakeData)
        {
            var log = LogManager.GetLogger(Global.CallerName());

            Emit(EVENT_HANDSHAKE, handshakeData);
            Id = handshakeData.Sid;
            Transport.Query.Add("sid", handshakeData.Sid);
            Upgrades     = FilterUpgrades(handshakeData.Upgrades);
            PingInterval = handshakeData.PingInterval;
            PingTimeout  = handshakeData.PingTimeout;
            OnOpen();
            // In case open handler closes socket
            if (ReadyStateEnum.CLOSED == this.ReadyState)
            {
                return;
            }
            this.SetPing();

            this.Off(EVENT_HEARTBEAT, new OnHeartbeatAsListener(this));
            this.On(EVENT_HEARTBEAT, new OnHeartbeatAsListener(this));
        }
 public void Call(params object[] args)
 {
     var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod());
     log.Info(string.Format("open args[0]={0} args.Length={1}", args[0], args.Length));
     HandshakeData = args[0] as HandshakeData;
     serverConnectionTest._manualResetEvent.Set();
 }
示例#4
0
        private void OnHandshake(HandshakeData handshakeData)
        {
            var log = LogManager.GetLogger(Global.CallerName());
            log.Info("OnHandshake");
            Emit(EVENT_HANDSHAKE, handshakeData);
            Id = handshakeData.Sid;
            Transport.Query.Add("sid", handshakeData.Sid);
            Upgrades = FilterUpgrades(handshakeData.Upgrades);
            PingInterval = handshakeData.PingInterval;
            PingTimeout = handshakeData.PingTimeout;
            OnOpen();
            // In case open handler closes socket
            if (ReadyStateEnum.CLOSED == this.ReadyState)
            {
                return;
            }
            this.SetPing();

            this.Off(EVENT_HEARTBEAT, new OnHeartbeatAsListener(this));
            this.On(EVENT_HEARTBEAT, new OnHeartbeatAsListener(this));
        }
 public void Call(params object[] args)
 {
     var log = LogManager.GetLogger(Global.CallerName());
     log.Info(string.Format("open args[0]={0} args.Length={1}", args[0], args.Length));
     HandshakeData = args[0] as HandshakeData;
 }
 public void Call(params object[] args)
 {
     LogManager.SetupLogManager();
     var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod());
     log.Info(string.Format("open args[0]={0} args.Length={1}", args[0], args.Length));
     HandshakeData = args[0] as HandshakeData;
 }