コード例 #1
0
        public static PureEngineIoOptions FromURI(Uri uri, PureEngineIoOptions opts)
        {
            if (opts == null)
            {
                opts = new PureEngineIoOptions();
            }

            opts.Host   = uri.Host;
            opts.Secure = uri.Scheme == "https" || uri.Scheme == "wss";
            opts.Port   = uri.Port;

            if (!string.IsNullOrEmpty(uri.Query))
            {
                opts.QueryString = uri.Query;
            }

            return(opts);
        }
コード例 #2
0
        public PureEngineIoSocket(PureEngineIoOptions options)
        {
            Debug = options.DebugMode;

            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?Helpers.DecodeQuerystring(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;
        }
コード例 #3
0
 public PureEngineIoSocket(Uri uri, PureEngineIoOptions options) : this(uri == null ? options : PureEngineIoOptions.FromURI(uri, options))
 {
 }
コード例 #4
0
 public PureEngineIoSocket(string uri, PureEngineIoOptions options) : this(uri == null ? null : String2Uri(uri), options)
 {
 }