简体   繁体   中英

instant messaging notification

I want to build instant messaging notification on my ASP.NET MVC (C#) web aplication. Any example for that or some other way to learn how to do this? I want something like a facebook mailing system.

Is that some type of a chat system or you would like to display some notification messages.

If it is the second one here is some info to get started.

1) Think about the types of messages you want to be able to display : Success, Error, Information, Fatal ... so on.

2) Most probably the messages will be returned from a controller and javascript will handle those. So, you would need one action result to return all the different types of messages. Thus, you can create your Message class

public class Message{
   public string Message{get;set;}
   public string Type{get;set;}
}

3) Lets say that you want to be able to return the message from anywhere. So, maybe you will need a base controller that all other controllers inherit from. In that controller have action results for all different types of messages. This is in case you need to be able to return a message from any ActionResult.

4) Return your messages as JSON and have a mechanism in your javascript to read the returned object. Just as an idea, have one div to display the message, and based on the type use a nice notification icon.

5) If you would like to make this process async, you can specify some timers/timeouts in javascript and every 5 minutes, check for your notifications.

Hope that is of some help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM