public async void getNotification(int userId, string stringGuid) { ConcurrentDictionary <int, List <NotificationDto> > notificationDict = await GetorCreateAsync(); string notificationStr = JsonConvert.SerializeObject(notificationDict.FirstOrDefault(x => x.Key == userId).Value); await _sseService.SendEventsAsync(notificationStr, true, stringGuid); }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { await _sseService.SendEventsAsync(String.Format(HEARTBEAT_MESSAGE_FORMAT, DateTime.UtcNow), false); await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken); } }