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); }
public WebSocket(Transport.Options opts) : base(opts) { this.Name = WebSocket.NAME; this.Cookies = new List <KeyValuePair <string, string> >(); foreach (KeyValuePair <string, string> cookie in opts.Cookies) { this.Cookies.Add(new KeyValuePair <string, string>(cookie.Key, cookie.Value)); } this.MyExtraHeaders = new List <KeyValuePair <string, string> >(); foreach (KeyValuePair <string, string> extraHeader in opts.ExtraHeaders) { this.MyExtraHeaders.Add(new KeyValuePair <string, string>(extraHeader.Key, extraHeader.Value)); } }
public void WssUri() { var options = new Transport.Options { Path = "/engine.io", Hostname = "test", Secure = true, Query = new Dictionary <string, string> { { "transport", "websocket" } }, TimestampRequests = false }; var ws = new WebSocket(options); Assert.Contains("wss://test/engine.io?transport=websocket", ws.Uri()); }
public void Uri() { var options = new Transport.Options { Path = "/engine.io", Hostname = Connection.CreateOptions().Hostname, Secure = false, Query = new Dictionary <string, string> { { "sid", "test" } }, TimestampRequests = false }; var polling = new Polling(options); var expected = string.Format("http://{0}/engine.io?sid=test&b64=1", options.Hostname); Assert.Contains(expected, polling.Uri()); }
public void WssUri() { 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 = true; options.Query = new Dictionary <string, string> { { "transport", "websocket" } }; options.TimestampRequests = false; var ws = new WebSocket(options); Assert.Contains("wss://test/engine.io?transport=websocket", ws.Uri()); }
public void Uri() { var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod()); log.Info("Start"); var options = new Transport.Options(); options.Path = "/engine.io"; options.Hostname = this.CreateOptions().Hostname; options.Secure = false; options.Query = new Dictionary <string, string> { { "sid", "test" } }; options.TimestampRequests = false; var polling = new Polling(options); var expected = string.Format("http://{0}/engine.io?sid=test&b64=1", options.Hostname); Assert.Contains(expected, polling.Uri()); }
private Transport CreateTransport(string name) { var query = new Dictionary <string, string>(_query); query.Add("EIO", Parser.Parser.Protocol.ToString()); query.Add("transport", name); if (Id != null) { query.Add("sid", Id); } var options = new Transport.Options { Hostname = _hostname, Port = _port, Secure = _secure, SslProtocols = _sslProtocols, Path = _path, Query = query, TimestampRequests = _timestampRequests, TimestampParam = _timestampParam, PolicyPort = _policyPort, Socket = this, Agent = Agent, ForceBase64 = ForceBase64, ForceJsonp = ForceJsonp, Cookies = _cookies, ExtraHeaders = ExtraHeaders }; if (name == WebSocket.NAME) { return(new WebSocket(options)); } if (name == Polling.NAME) { return(new PollingXHR(options)); } throw new EngineIOException("CreateTransport failed"); }
public void WsTimestampedUri() { var options = new Transport.Options { Path = "/engine.io", Hostname = "test", Secure = false, Query = new Dictionary <string, string> { { "sid", "test" } }, TimestampRequests = true, TimestampParam = "woot" }; var ws = new WebSocket(options); var 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); var m = r.Match(test); Assert.True(m.Success); }
public PollingXHR(Transport.Options options) : base(options) { }
public Polling(Transport.Options opts) : base(opts) { this.Name = Polling.NAME; }