コード例 #1
0
 public async Task SendMessage()
 {
     if (!_cache.TryGetValue("employeeCache", out string response))
     {
         EmployeeListener employeeList = new EmployeeListener(_hubContext, _cache, _configuration);
         employeeList.ListenForAlarmNotifications();
         string jsonEmployeeAlarm = employeeList.GetAlarmList();
         _cache.Set("employeeCache", jsonEmployeeAlarm);
         await Clients.All.SendAsync("ReceiveMessage", _cache.Get("employeeCache").ToString());
     }
     else
     {
         await Clients.All.SendAsync("ReceiveMessage", _cache.Get("employeeCache").ToString());
     }
 }