Beispiel #1
0
 public ActionResult Test(int?id, string message)
 {
     if (ModelState.IsValid)
     {
         if (id != null)
         {
             var    context = GlobalHost.ConnectionManager.GetHubContext <ContentHub>();
             string connID  = ContentHub.GetClientConnection((int)id);
             if (connID != null)
             {
                 context.Clients.Client(connID).test1(message);
             }
             else
             {
                 TempData["message"] = "Brak podlaczonego klienta";
             }
         }
     }
     return(RedirectToAction("Test"));
 }
Beispiel #2
0
        private void NotifyCampaignUpdate(List <int> clientIds, int campaignId)
        {
            var context = GlobalHost.ConnectionManager.GetHubContext <ContentHub>();

            var schedule = clientScheduleService.GetCurrentSchedule(campaignId);

            if (schedule != null)
            {
                string message = clientScheduleService.GetScheduleAsString(schedule);

                foreach (int id in clientIds)
                {
                    string connID = ContentHub.GetClientConnection(id);
                    if (connID != null)
                    {
                        context.Clients.Client(connID).test1(message);
                        //return true;
                    }
                    //else
                    //    return false;
                }
            }
        }