0

How do you connect to a signalR Hub from a web role ?

i have a webrole that connects to an event hub, all the events are received fine, but when i try to pass this data to the web page via my SignalR hub, i get nothing, no errors, and no data at the page, i am using the following to make the connection to the hub

var hubContext = GlobalHost.ConnectionManager.GetHubContext<MyHub>();
hubContext.Clients.All.SendServerTime("Data To Send");

i am using an example that i found that just updates the webpage with the time, nice and simple, and only has a single parameter. the example has a loop in the constructor that sends the time every second, and this updates all the connected pages fine, i have tried the same loop in the web role, and nothing happens.

i have had it working if i connect to a webapi using the code above, but i assumed i should be able to connect directly to the SignalR hub from the WebRole.

any pointers would be very much appreciated.

Racing57
  • 81
  • 1
  • 3
  • 15

1 Answers1

0

ok, so I thought I would let people know the outcome on this, I couldn't get the SignalR working from the WebRole, and I even asked a contact at Microsoft Technical Services. so what I did do, is create a new MVC site, and start the Event Hub Listener Thread from the Global.asax, it worked straight away. every message that comes in on the EventHub Thread is passed to the clients via SignalR..

Racing57
  • 81
  • 1
  • 3
  • 15