Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to implement facebook like notification?

I am trying to implement a Facebook-like live notifications system to notify users whenever someone adds them as friend, like their post or posts replies to their comments.

All the database and PHP part is done, but I can't figure out how to implement it like Facebook has.

Whenever someone likes/comments on your post in Facebook the light blue box appears at the bottom left corner of the screen. This happens as soon as someone hits like button or posts comment in Facebook. I would like to know what I should do to implement this.

Using YUI or any JavaScript framework I can query a database table after n seconds to check for notifications. This method is too heavy.

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.

How can I achieve this?

like image 696
Vinay Jeurkar Avatar asked Mar 19 '11 03:03

Vinay Jeurkar


People also ask

How do I get notifications of likes on Facebook?

Tap in the top right of Facebook, then tap your name. Tap Settings. Tap Notification Settings or Text Messaging below Notifications. Tap to adjust how you get notifications and what you get notified about.

Does Facebook Notify for likes?

That notification will immediately be added to the top of their “Notifications” list. If they already had Facebook open when you “Liked” the post, they'll see the notification that you “liked” it when they view their notifications even if you have already “unliked” it before they click to view their notifications.

What is a push notification from Facebook?

Push notifications: sent when you're not actively using Facebook (example: on your device's lockscreen). In-app notifications: sent when you're using Facebook. These show up as numbers over the in Facebook's navigation, or over the Facebook app on your phone.

How do I get notifications when a friend posts 2022 on Facebook?

Just navigate to a friend's Facebook profile page and look for the “Friends” button floating over their cover photo. Click the button to pull up the drop down menu and select either “Get Notifications” or “Close Friends”, depending on your preference.


3 Answers

You should look into COMET techniques, such as forever frame (tutorial) and long polling. That allows you to have a form of a server->client push communication.

like image 169
Matthew Flaschen Avatar answered Oct 05 '22 20:10

Matthew Flaschen


I am really surprised nobody has mentioned PubNub and Pusher

These two (competitors) are building infrastructure which allows for realtime notifications, just like Facebook.

like image 33
Samudra Avatar answered Oct 05 '22 21:10

Samudra


Facebook notification

like image 43
Dead Programmer Avatar answered Oct 05 '22 22:10

Dead Programmer