Saving variables on the server side of SignalR

I was wondering how I can store variable variable servers that can be run on connected clients when called ?.

I use a parallel dictionary to track the connection GUIDs and wonder if I can store strings or other data types on the server, for example the last 10 messages, so when a new connection occurs, the client receives the last 10 messages even if they are not connected in advance.

I could see a lot of good for him, but I don’t see anything in it, did it frown? or bad practice? I see that storing huge strings on the server side can cause a lot of problems. But what am I really proposing so badly?

+4
source share
1 answer

No, he did not frown at all. JabbR , which is the flagship SignalR testing application, is an IRC-like chat system that stores "rooms", messages, usernames / identifications, etc.

How you store them is up to you. JabbR uses the ADO.NET Entity Framework to store data in SQL DB. You could obviously do the same, or use RavenDB or Azure Table Storage or something else.

All you have to do is implement your logic in the hub, and then when the message arrives, you do any access to the data / data store for that message.

I highly recommend taking a look at the JabbR source code, which is available here on GitHub , to better understand how this might work for you.

+5
source

All Articles