コード例 #1
0
 public Manager(Uri uri, ManagerOptions opts)
 {
     if (opts == null)
     {
         opts = new ManagerOptions();
     }
     if (opts.Path == null)
     {
         opts.Path = "/socket.io";
     }
     this.Options    = opts;
     this.Nsps       = new System.Collections.Concurrent.ConcurrentDictionary <string, Socket>();
     this.Subs       = new Queue <On.IHandle>();
     this.TasksQueue = new Queue <TaskWorker>();
     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 <Packet>();
     this.Encoder      = new Parser.Encoder();
     this.Decoder      = new Parser.Decoder();
     this.AutoConnect  = opts.AutoConnect;
     if (AutoConnect)
     {
         Open();
     }
 }
コード例 #2
0
 public Manager(ManagerOptions opts) : this(null, opts)
 {
 }