Пример #1
0
 public Manager(Uri uri, Options opts)
 {
     if (opts == null)
     {
         opts = new Options();
     }
     if (opts.Path == null)
     {
         opts.Path = "/socket.io";
     }
     this.Opts = opts;
     this.Nsps = ImmutableDictionary.Create <string, Socket>();
     this.Subs = new ConcurrentQueue <On.IHandle>();
     this.Reconnection(opts.Reconnection);
     this.ReconnectionAttempts(opts.ReconnectionAttempts != 0 ? opts.ReconnectionAttempts : int.MaxValue);
     this.ReconnectionDelay(opts.ReconnectionDelay != 0 ? opts.ReconnectionDelay : 1000);
     this.ReconnectionDelayMax(opts.ReconnectionDelayMax != 0 ? opts.ReconnectionDelayMax : 5000);
     this.Timeout(opts.Timeout < 0 ? 20000 : opts.Timeout);
     this.ReadyState     = ReadyStateEnum.CLOSED;
     this.Uri            = uri;
     this.Attempts       = 0;
     this.Encoding       = false;
     this.PacketBuffer   = new List <Parser.Packet>();
     this.OpeningSockets = new HashSet <Socket>();
     this.Encoder        = new Parser.Parser.Encoder();
     this.Decoder        = new Parser.Parser.Decoder();
     this.AutoConnect    = opts.AutoConnect;
     if (AutoConnect)
     {
         Open();
     }
 }
Пример #2
0
 public Manager(Uri uri, Options opts)
 {
     if (opts == null)
     {
         opts = new Options();
     }
     if (opts.Path == null)
     {
         opts.Path = "/socket.io";
     }
     this.Opts = opts;
     this.Nsps = ImmutableDictionary.Create<string, Socket>();
     this.Subs = new Queue<On.IHandle>();
     this.Reconnection(opts.Reconnection);
     this.ReconnectionAttempts(opts.ReconnectionAttempts != 0 ? opts.ReconnectionAttempts : int.MaxValue);
     this.ReconnectionDelay(opts.ReconnectionDelay != 0 ? opts.ReconnectionDelay : 1000);
     this.ReconnectionDelayMax(opts.ReconnectionDelayMax != 0 ? opts.ReconnectionDelayMax : 5000);
     this.Timeout(opts.Timeout < 0 ? 20000 : opts.Timeout);
     this.ReadyState = ReadyStateEnum.CLOSED;
     this.Uri = uri;
     this.Connected = 0;
     this.Attempts = 0;
     this.Encoding = false;
     this.PacketBuffer = new List<Parser.Packet>();
     this.Encoder = new Parser.Parser.Encoder();
     this.Decoder = new Parser.Parser.Decoder();
     this.AutoConnect = opts.AutoConnect;
     if (AutoConnect)
     {
         Open();
     }
 }