SignalR for online user tracking and chat

We are working on a network application and are going to introduce a couple of new features. 1. Tracking online users 2. Chat (single chat and later group chat)

I looked at SingalR and that seems promising. We are using ASP.NET MVC 3 and are thinking about using hubs. My question is to start with, is SignalR better than a simple chat poll? What will be better in terms of scalability? I saw other questions about SO, but I couldn't figure out which one is better in terms of scalability.

The second question is the use of SignalR, we can use it to track online users. We can call a server-side function from each client at regular intervals to say "I'm online", and in the hub method we can simply set the isOnline bit to the database. Once the client is disconnected, we can disable the bit. Would this job or a simple survey be better here? How to install the user offline if we use a simple survey?

+4
source share
2 answers

I use SignalR as a kind of chat architecture. Works great on our single IIS server setup. To test scalability: Sclaing-out-SignalR

, " ", , this

var clients = Hub.GetClients<Type of your hub here>();

. - , -, .

, - . ", ".

public class MyHub : Hub, IDisconnect
{
    public Task Disconnect()
    {
        // Query the database to find the user by it client id.
        var user = db.Users.Where(u => u.ConnectionId == Context.ConnectionId);
        return Clients.disconnected(user.Name);
    }
}

.

, .

+5

SignalR , , - , db. , , signalR MVC, signalR .net 4.5.

, , IIS. 1000+ .

, signalR, , .

+1

All Articles