public string Uri() { //var query = this.Query; var query = new Dictionary <string, string>(Query); //if (Query == null) //{ // query = new Dictionary<string, string>(); //} string schema = this.Secure ? "https" : "http"; string portString = ""; if (this.TimestampRequests) { query.Add(this.TimestampParam, DateTime.Now.Ticks + "-" + Transport.Timestamps++); } query.Add("b64", "1"); string _query = ParseQueryString.Encode(query); if (this.Port > 0 && (("https" == schema && this.Port != 443) || ("http" == schema && this.Port != 80))) { portString = ":" + this.Port; } if (_query.Length > 0) { _query = "?" + _query; } return(schema + "://" + this.Hostname + portString + this.Path + _query); }
public string Uri() { Dictionary <string, string> query = null; query = this.Query == null ? new Dictionary <string, string>() : new Dictionary <string, string>(this.Query); string schema = this.Secure ? "wss" : "ws"; string portString = ""; if (this.TimestampRequests) { query.Add(this.TimestampParam, DateTime.Now.Ticks.ToString() + "-" + Transport.Timestamps++); } string _query = ParseQueryString.Encode(query); if (this.Port > 0 && (("wss" == schema && this.Port != 443) || ("ws" == schema && this.Port != 80))) { portString = ":" + this.Port; } if (_query.Length > 0) { _query = "?" + _query; } return(schema + "://" + this.Hostname + portString + this.Path + _query); }
public SocketEngine(Options options) { if (options.Host != null) { var pieces = options.Host.Split(':'); options.Hostname = pieces[0]; if (pieces.Length > 1) { options.Port = int.Parse(pieces[pieces.Length - 1]); } } Secure = options.Secure; Hostname = options.Hostname; Port = options.Port; Query = options.QueryString != null?ParseQueryString.Decode(options.QueryString) : new Dictionary <string, string>(); Upgrade = options.Upgrade; Path = (options.Path ?? "/engine.io").Replace("/$", "") + "/"; TimestampParam = (options.TimestampParam ?? "t"); TimestampRequests = options.TimestampRequests; var defaultTransport = new List <string>(); defaultTransport.Add(Polling.NAME); defaultTransport.Add(WebSocket.NAME); Transports = options.Transports ?? defaultTransport; PolicyPort = options.PolicyPort != 0 ? options.PolicyPort : 843; RememberUpgrade = options.RememberUpgrade; Cookies = options.Cookies; if (options.IgnoreServerCertificateValidation) { ServerCertificate.IgnoreServerCertificateValidation(); } }