Reputation: 217
I read some documentation about using a in memory store for a SignalR app.
http://www.asp.net/signalr/overview/guide-to-the-api/mapping-users-to- connections#inmemory
I believe you can use a Static Collection to hold your objects you need to process within the hub. Is it possible to have access to this Static collection from outside the hub? If you have other objects within the app who need access to this in memory store what is the best practise?
Upvotes: 0
Views: 301
Reputation: 17564
Best practice is to let the Hub act only as a Hub, no business logic of any kind. Also dont call the hub client methods from your core logic classes, this is highly coupled and is bad practice. Abstract the Hub either with your own code or use a library, I have created this abstraction library that is based on the Event aggregation pattern.
http://andersmalmgren.com/2014/05/27/client-server-event-aggregation-with-signalr/
Upvotes: 2
Reputation: 217
Just make the Static collection public and access it like any other Static collections. The collection will be lost when the app closes so would need to be stored persisted somewhere is needed.
Upvotes: 1