0

I want to build an web application as same as mini facebook. But I have an problem that I don't know how to send in notification immediately for user when has an user's friend who comment in user's post. and i want to handle list friend is online of user because i want to send to all friend of user when him post a new stauts. Can you help me and send for me some ideas and some examples. I just code my app by servlet,jsp,html,javascript.

Thank you very much.

duc vu
  • 31
  • 2

1 Answers1

1

You can try 2 things:

  1. Push the notifications to all users when someone has posted something.
  2. Pull the notifications. With this you keep checking if something new has been added, at some time interval.

The first one is better because you dont have to waste resources checking on the server constantly.

Firstly check this post to get you started What are Long-Polling, Websockets, Server-Sent Events (SSE) and Comet?

Community
  • 1
  • 1
Yoshua Nahar
  • 1,304
  • 11
  • 28
  • It's also worth noting that a good idea would be to store in the database weather a previous notification for the same post was read or not, allowing you to add extra names in the most recent notification (eg. Sav and Dave commented on John's post instead of two notifications in the list for each Sav and Dave) – MyNameWouldGoHere Feb 29 '16 at 17:28