SignalR request protocol, hub lifetime

I start with signalR using asp.net webapi, and I'm trying to understand the entire request / connection conveyor signalR, as well as the hub lifetime, and who creates and removes the hub instance (is it created on every connection between the client and server?)

One reason is that we need to understand how we should use IoC in the signalR request script, how we manage the dependency lifetime, namely: ISession or DBContext .

+4
source share
1 answer

Hub instances are created for each individual request from the client. They are not kept, so you should not put any state in them.

Hubs are created using the factory system, which you can configure using the built-in dependency injection engine .

+5
source

All Articles