I want to know if specific User open specific page like Chat page because user may be online but not open specific page.
I am using ASP.NET MVC 5 with SignalR
The case is that, there is one to one Chat page between two specific users suppose A & B, and when user A send message to user B, there are option:
1- user B open chat page, so he will receive message in chat page by signalr but not receive notification
2- user B is online but not open chat page, so he will receive notification in notification menu in layout page but not receive message in chat page
So finally i need to know if user open chat page inside the SendMessage method in ChatHub class at the server to decide the option
Send message in Hub class at server:
public void SendMessage(string msg, string userId)
{
Clients.Client(connectionId).receiveMessage(chatMsge);
// here i want to check if user is in chat page or not
if(user not in chat page)
{
Clients.Client(connectionId).receiveNotify(chatMsge);
}
}
the problem is that i need to check the condition in the sendMessage method, so i need to some method go to client and return with the result
I am searched a lot of time but cannot find what i need
The code of signalr found in Layout page
No error message it is logic of signalR i want to understand