Calling signalR hub methods from console application

1.2k views Asked by At

I have a requirement like, when my database get updated with new data, I want to trigger the refreshAllClient method on signalR hub. This method call every client connected to my application and trigger refresh method on client. So that all users will have live record. Actually the data are coming from different sources(multiple clients), when the data are ready, console application will start to move data into database. Once date get updated, console application need to trigger method on signalR. How do I trigger signalR hub from console application?

1

There are 1 answers

1
pm100 On BEST ANSWER

the key is this kind of thing

  var ctx = GlobalHost.ConnectionManager.GetHubContext<yourhub>();
  ctx.Clients.Client(connectionId).<your method>  

The point is you now have a hub context that allows sending to a client a group or all