Kywillis
Kywillis

Reputation: 717

Trying to Get ConnectionID For Current Request in SignalR

My application is a WebApi project using SignalR, similar to this http://blog.johnbrunnings.com/tag/signalr/. I need to get the connectionID in the controller but I'm having trouble working that out as the controller inherits from a generic type. The definition for my class looks like this:

public class PatientListController : ApiControllerWithHub<PatientListHub>

So in my code how would I get to the connectionid? I think it is the fact the hub is being used in a generic that is throwing me off but I have been messing with this for a while and cannot figure out how to get to it.

thanks in advance.

EDIT What I really need is access to HubCallerContext, any ideas?

Upvotes: 3

Views: 1113

Answers (1)

Kywillis
Kywillis

Reputation: 717

Turns out it appears this is just not possible. Looking at this video http://channel9.msdn.com/Events/TechDays/Belgium-2013/25 at about the 1:04 mark there is a comment about the Hub Caller Context not being available if working with Web API. The solution is to call the hub directly if you need access to the connectionid. Bummer.

Upvotes: 2

Related Questions