문제

I'm just start testing SignalR for monitoring application . I have a control which make a call to the Hub by the client side. I noticed , each time the client make Connection.Hub.Start() it creates a new Hub instance in the server , I need to refresh my control all the time , so I don't want it to create new Hub for each one.

Is there a way to create single Hub for all clients or I'm missing something?

도움이 되었습니까?

해결책

A Hub instance is created for each request, much like an ASP.NET Page instance is created for each request in WebForms, a Controller is created for each request in ASP.NET MVC or a WCF service instance is created for each service request when using InstanceMode.PerCall.

If you want to maintain shared state between Hub requests/instances you would need to use a static field or some other, more advanced form of state sharing (e.g. dependency injected singleton).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top