Beispiel #1
0
        public SignalrClient(ILogger <SignalrClient> logger, IOptions <SysOptions> options, IMediator mediator)
        {
            _mediator = mediator;
            _logger   = logger;
            _options  = options?.Value;

            _subscriptions = _options?.SignalrBus?.DefaultTopics;

            _hub = new HubConnectionBuilder()
                   .WithUrl(_options?.SignalrBus?.HubUrl)
                   //.WithAutomaticReconnect()
                   .Build();

            _hub.Closed += OnClose;

            _hub.On <SignalrMessage>("Sync", async data =>
            {
                var type = ReflectionUtils.CreateInstanceFromString(data.Type).GetType();
                var obj  = JObject.Parse(data.JsonData).ToObject(type);
                await _mediator.Publish(obj);

                //if( data.SmgType == SignalrMessageTypeEnum.Push ) {

                //}
            });
        }
Beispiel #2
0
 protected HubBase(ICurrent current, IOnlineManager onlineManager, ILogger <HubBase> logger, IOptions <SysOptions> sysOptions)
 {
     Current       = current;
     OnlineManager = onlineManager;
     Logger        = logger;
     SysOptions    = sysOptions?.Value;
 }
Beispiel #3
0
 public PushService(ICurrent current, IOnlineManager onlineManager, ILogger <PushService> logger, ITokenService tokenService, IMediator mediator, IDeviceService deviceService, ITypeFinder typeFinder, ITypeResolve typeResolve, SignalrClient signalrClient, IOptions <SysOptions> options)
 {
     _tokenService  = tokenService;
     _mediator      = mediator;
     _deviceService = deviceService;
     _typeFinder    = typeFinder;
     _typeResolve   = typeResolve;
     _current       = current;
     _onlineManager = onlineManager;
     _logger        = logger;
     _signalrClient = signalrClient;
     _options       = options?.Value;
 }
Beispiel #4
0
 public HealthCheckWorker(IHttpClientFactory httpClientFactory, IOptions <SysOptions> options, ILogger <HealthCheckWorker> logger)
 {
     _logger            = logger;
     _options           = options?.Value;
     _httpClientFactory = httpClientFactory;
 }
Beispiel #5
0
 public FirewallFilter(ICache cache, ICurrent current, IOptions <SysOptions> options)
 {
     _cache   = cache;
     _current = current;
     _options = options?.Value;
 }
Beispiel #6
0
 public SignalrClientWorker(ILogger <SignalrClientWorker> logger, SignalrClient signalrClient, IOptions <SysOptions> options)
 {
     _logger        = logger;
     _options       = options?.Value;
     _signalrClient = signalrClient;
 }