Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hai,
Iam developing a chat application using asp.net mvc.For this iam using signalr.But what iam not getting is whenever the user login i have to make the particular user status as online(like showing green),and if the user goes offline i have to change status(as red).Please help me in doing this....
here is my jquery code where iam binding the users(fetching from db)
JavaScript
chat.server.getConnectedUsers().done(function (class1) {

            usernameList.empty();
            for (var i = 0; i < class1.length; ++i) {
                if (class1[i].username != _chatUsername) {
                    usernameList.append(class1[i].username);
                    

                }
            }

        });

[Edit]Code block formatting added[/Edit]
Posted
Updated 23-Jul-13 0:11am
v2

1 solution

There is a overriding method called OnDisconnect method. In this method take the conectionId who disconnect .from the Context you can get the disconnected user connectionId Context.ConnectionId and make the user as offline.
C#
public override Task OnDisconnected()
{
}


Hope this helps
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900