SignalR request pipeline, Hub lifetime

萝らか妹 提交于 2020-01-02 05:37:35

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/24871359/signalr-request-pipeline-hub-lifetime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!