Example #1
0
        public Socket(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;
            _sslProtocols = options.SslProtocols;
            _hostname     = options.Hostname;
            _port         = options.Port;
            _query        = options.QueryString != null
                ? ParseQS.Decode(options.QueryString)
                : new Dictionary <string, string>();

            if (options.Query != null)
            {
                foreach (var item in options.Query)
                {
                    _query.Add(item.Key, item.Value);
                }
            }


            _upgrade           = options.Upgrade;
            _path              = (options.Path ?? "/engine.io").Replace("/$", "") + "/";
            _timestampParam    = options.TimestampParam ?? "t";
            _timestampRequests = options.TimestampRequests;
            _transports        = options.Transports ?? ImmutableList <string> .Empty.Add(Polling.NAME).Add(WebSocket.NAME);

            _policyPort      = options.PolicyPort != 0 ? options.PolicyPort : 843;
            _rememberUpgrade = options.RememberUpgrade;
            _cookies         = options.Cookies;
            if (options.IgnoreServerCertificateValidation)
            {
                ServerCertificate.IgnoreServerCertificateValidation();
            }
            ExtraHeaders = options.ExtraHeaders;
        }
Example #2
0
        public Socket(Socket.Options options)
        {
            if (options.Host != null)
            {
                string[] strArray = options.Host.Split(':');
                options.Hostname = strArray[0];
                if (strArray.Length > 1)
                {
                    options.Port = int.Parse(strArray[strArray.Length - 1]);
                }
            }

            this.Secure   = options.Secure;
            this.Hostname = options.Hostname;
            this.Port     = options.Port;
            this.Query    = options.QueryString != null?ParseQS.Decode(options.QueryString) : new Dictionary <string, string>();

            if (options.Query != null)
            {
                foreach (KeyValuePair <string, string> keyValuePair in options.Query)
                {
                    this.Query.Add(keyValuePair.Key, keyValuePair.Value);
                }
            }

            this.Upgrade           = options.Upgrade;
            this.Path              = (options.Path ?? "/engine.io").Replace("/$", "") + "/";
            this.TimestampParam    = options.TimestampParam ?? "t";
            this.TimestampRequests = options.TimestampRequests;
            this.Transports        = options.Transports ?? ImmutableList <string> .Empty.Add(Polling.NAME).Add(WebSocket.NAME);

            this.PolicyPort      = options.PolicyPort != 0 ? options.PolicyPort : 843;
            this.RememberUpgrade = options.RememberUpgrade;
            this.Cookies         = options.Cookies;
            if (options.IgnoreServerCertificateValidation)
            {
                ServerCertificate.IgnoreServerCertificateValidation();
            }
            this.ExtraHeaders = options.ExtraHeaders;
        }
Example #3
0
        public Socket(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;
            Proxy    = options.Proxy;
            Query    = options.QueryString != null?ParseQS.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();
            }
        }