/// <summary> /// Creates a new instance of OctovisorClient /// </summary> /// <param name="config">A config object containing your token and other settings</param> protected BaseClient(OctoConfig config) { if (!config.IsValid()) { throw new Exception("Invalid Octovisor client configuration"); } this.Config = config; this.Reader = new MessageReader(config.MessageFinalizer); this.Buffer = new byte[config.BufferSize]; this.MessageFactory = new MessageFactory(config.CompressionThreshold); this.IsRegisteredInternal = false; this.IsConnected = false; }
/// <summary> /// Instanciates a new OctoClient based on the config object passsed /// </summary> /// <param name="config">The config object</param> public OctoClient(OctoConfig config) : base(config) { this.ProcessName = config.ProcessName; this.ServerAddress = config.Address; this.ServerPort = config.Port; this.Processes = new Dictionary <string, RemoteProcess>(); this.TransmissionHandlers = new Dictionary <string, Func <Message, string> >(); this.TransmissionTCSs = new Dictionary <int, TaskCompletionSource <string> >(); this.Timeout = config.Timeout; this.ProcessUpdate += this.OnProcessUpdate; this.ProcessesInfoReceived += this.OnProcessesInfoReceived; this.MessageRequestReceived += this.OnMessageRequestReceived; this.MessageResponseReceived += this.OnMessageResponseReceived; this.Disconnected += this.OnClientDisconnected; }