User283571144 posted
Hi chamila91,
As far as I know,if you want to access the server hub in MVC controller, I suggest you could try to use
signalr client library.
Then you could use below codes to call the server hub method.
Server code for a method that has no return value
public class StockTickerHub : Hub
{
public void JoinGroup(string groupName)
{
Groups.Add(Context.ConnectionId, groupName);
}
}
Client hub method:
using (var hubConnection = new HubConnection("http://www.contoso.com/"))
{
IHubProxy stockTickerHubProxy = hubConnection.CreateHubProxy("StockTickerHub");
stockTickerHubProxy.On<Stock>("UpdateStockPrice", stock => Console.WriteLine("Stock update for {0} new price {1}", stock.Symbol, stock.Price));
await hubConnection.Start();
stockTickerHubProxy.Invoke("JoinGroup", "SignalRChatRoom");
}
Best Regards,
Brando