2
Reply

Hide user in Users list using signalr

Jey Kumar

Jey Kumar

Mar 6 2017 7:16 AM
230

I am developing a chat application using signalr in asp.net which is mainly used for customer service now i am facing problem when one operator accepted the client request for private chat this client user should not be displayed for other operators except the operator who accepted, i am struggling to solve this issue

the code i have written in hub class is

i have declared ConnectedUsers as

static List<UserDetail> ConnectedUsers = new List<UserDetail>();

and added users using

ConnectedUsers.Add(new UserDetail { ConnectionId = id, UserName = userName });

and tried to remove private chat users using

public void Remove(string UserId, string User) { UserDetail item = new UserDetail();         item.ConnectionId = UserId;         item.UserName = User; if (item != null) { ConnectedUsers.Remove(item); } }

i am calling this code from html page as follows

chatHub.server.remove(userId, userName);

but this approach is not removing or hiding the user from userlist


Upload Source Code  Select only zip and rar file.
Answers (2)