Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR request pipeline, Hub lifetime

I am starting on signalR with asp.net webapi, and I am trying to understand the whole signalR request/connection pipeline and what is the lifetime of the hub and who creates and dispose the hub instance (does it gets created on every communication between client and server?)

One of the reason is that we need to understand how we should be using an IoC contain in signalR request scenario, how we control the lifetime of the dependency correct specifically the ISession or DBContext.

like image 584
Eatdoku Avatar asked Jul 21 '14 17:07

Eatdoku


1 Answers

Hubs instances are created at every single request from a client. They are not kept around, therefore you should not put any state in them.

Hubs are created through a factory system which you can customize through its built-in dependency injection mechanism.

like image 80
Wasp Avatar answered Oct 02 '22 05:10

Wasp