コード例 #1
0
        public void WsTimestampedUri()
        {
            var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod());
            log.Info("Start");

            var options = new Transport.Options();
            options.Path = "/engine.io";
            options.Hostname = "test";
            options.Secure = false;
            options.Query = new Dictionary<string, string> {{"sid", "test"}};
            options.TimestampRequests = true;
            options.TimestampParam = "woot";
            var ws = new WebSocket(options);

            string pat = @"ws://test/engine.io\?sid=test&(woot=[0-9]+-[0-9]+)";
            var r = new Regex(pat, RegexOptions.IgnoreCase);
            var test = ws.Uri();
            log.Info(test);
            Match m = r.Match(test);
            Assert.True(m.Success);
        }
コード例 #2
-2
        public void WsUri()
        {
            var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod());
            log.Info("Start");

            var options = new Transport.Options();
            options.Path = "/engine.io";
            options.Hostname = "test";
            options.Secure = false;
            options.Query = new Dictionary<string, string> {{"transport", "websocket"}};
            options.TimestampRequests = false;
            var ws = new WebSocket(options);
            Assert.Contains("ws://test/engine.io?transport=websocket", ws.Uri());
        }