And check whether who are the clients not in online when you send the message. Use a ConcurrentDictionary to maintain an online list each time a client connects to the system. My blogpost shows how to do that.
Then if the Client ID is not in the online list, save the Client ID along with the message in a DB. When each client connects to the system, (at the $.connection.hub.start().done() method may be) Check whether there are any recrods in the DB for his/her
client ID. If there are any, show him/her the notification.
I think to use a DB, too. but have a question about perfomance
I was wondering if there is any server side mod or scripting can be done so that whenever there is new notification entry in my database table the server will tell that particular client. That way unnecessary request calls from client to server will be avoided
completely and system can work efficiently for website with more than 50,000 users online at a time.
I was wondering if there is any server side mod or scripting can be done so that whenever there is new notification entry in my database table the server will tell that particular client. That way unnecessary request calls from client to server will be avoided
completely and system can work efficiently for website with more than 50,000 users online at a time.
Yeah you can do that using SQLDependency and SignalR. Check the below link from Brij.
I understand, when a user login to system, it will add to _clients
in here, which is best solution for addGroup SignalR. how compare _clients with List<int>follows = FindAllUserFollowingThisUser(int thisUserId ); then add to a Group_xxx and send notify to users following.
in here, which is best solution for addGroup SignalR. how compare _clients with List<int>follows = FindAllUserFollowingThisUser(int thisUserId ); then add to a Group_xxx and send notify to users following.
monotech
Member
2 Points
20 Posts
How to send a message pending status
Feb 24, 2013 07:24 AM|LINK
Hi all,
I am working with a project and implement facebook-like notification
In here, i send a notify to group friend, but this group don't online all at time.
How to when a member login to system will revice this notifys
Thank you!
Ruchira
All-Star
42887 Points
7020 Posts
MVP
Re: How to send a message pending status
Feb 24, 2013 03:11 PM|LINK
Hello,
You can do something like this,
You can assign a connection ID for each client. Following article will help you with that
http://www.kevgriffin.com/maintaining-signalr-connectionids-across-page-instances/
And check whether who are the clients not in online when you send the message. Use a ConcurrentDictionary to maintain an online list each time a client connects to the system. My blogpost shows how to do that.
http://ruchirac.blogspot.com/2013/02/creating-chat-application-in-aspnet.html
Then if the Client ID is not in the online list, save the Client ID along with the message in a DB. When each client connects to the system, (at the $.connection.hub.start().done() method may be) Check whether there are any recrods in the DB for his/her client ID. If there are any, show him/her the notification.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.monotech
Member
2 Points
20 Posts
Re: How to send a message pending status
Feb 24, 2013 05:55 PM|LINK
Hi Ruchira,
Thanks for reply
I think to use a DB, too. but have a question about perfomance
I was wondering if there is any server side mod or scripting can be done so that whenever there is new notification entry in my database table the server will tell that particular client. That way unnecessary request calls from client to server will be avoided completely and system can work efficiently for website with more than 50,000 users online at a time.
Ruchira
All-Star
42887 Points
7020 Posts
MVP
Re: How to send a message pending status
Feb 25, 2013 04:51 AM|LINK
Hello,
Yeah you can do that using SQLDependency and SignalR. Check the below link from Brij.
http://techbrij.com/database-change-notifications-asp-net-signalr-sqldependency
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.monotech
Member
2 Points
20 Posts
Re: How to send a message pending status
Mar 03, 2013 07:57 PM|LINK
Hi Ruchira,
I have a design a database for test, 2 MembershipUser and Follow table
In Follow table:
{1, user1, user2} this is mean user1 following user2
Now, when user2 post a comment, system will send a notify to user who following user2
Code( i using asp.net mvc4):
//controller
public ActionResult PostComment(CommentModel model)
{
// add to database
List<int>follows = FindAllUserFollowingThisUser(int thisUserId );
//and send message to follows use SignalR in here
}
//HubFollow.cs
//Client.cs{UserId, UserName}
public static List<Client>_clients;
I understand, when a user login to system, it will add to _clients
in here, which is best solution for addGroup SignalR. how compare _clients with List<int>follows = FindAllUserFollowingThisUser(int thisUserId ); then add to a Group_xxx and send notify to users following.
I don't understand.........
Please help me!
Ruchira
All-Star
42887 Points
7020 Posts
MVP
Re: How to send a message pending status
Mar 04, 2013 07:29 AM|LINK
Hi,
You can use Groups for that. Check below
http://www.codeproject.com/Articles/404662/SignalR-Group-Notifications
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.monotech
Member
2 Points
20 Posts
Re: How to send a message pending status
Mar 04, 2013 02:48 PM|LINK
Ruchira,
I have a question at:
http://stackoverflow.com/questions/15205393/design-a-notifications-help-for-compare-two-table-entity-framework
Please help!