Instant notifications like Facebook

I am building a social application and was wondering how facebook achieve their notifications. As you know, facebooks notifications are instant. As soon as someone takes an action, people are notified.

I assume they don’t have a query running on the database all the time.

Can someone point me in the right direction. Thanks

How make something like Facebook Notifications?

Please, read all the question before thinking wrong things. I’m trying to implement a Facebook Notifications system like, but I need some help for style this. I already make the notifications, the ba

Facebook like notifications tracking (DB Design)

I am just trying to figure out how facebook’s database is structured for tracking notifications. Wont go much into complexity like facebook is. If we imagine a simple table structure for notificaitons

Facebook like Notifications System

I am developing a face book like notification module in php/mysql where in the user is notified with the latest activities among his friends (Added Photo/Added Video/Commented etc….). What is the be

Facebook Like notifications?

I saw a website today that stated: Share/Like this site and get 10% discount. I was wondering: is there any way to track when someone shares/likes my site? Can I store some data of that user in my a

Database to track user notifications or activity (Facebook like)

I’ve just read the following posts on the same topic: Facebook like notifications tracking (DB Design) and Database design to store notifications to users Some solutions were offered but not exactly w

Push notifications service like ios facebook app

Have you ever been using facebook app in smartphone or tablet? I’m wondering how it can send push notifications to you when you have comments, likes..etc. I’m trying to know about it and i found nodej

How to make a Facebook like Notifications Table Structure?

I am making a social app like facebook using Yii Framework and MYSQL. It has a notifications button at the top similar to facebook. When someone posts in a group or someone from your friendlist is goi

notifications without reloading the page (like facebook or google plus notifications)

What would be the ideal mechanism to get notifications like in Facebook in to a dashboard ?. I am thinking the best way is to do a Ajax call to a php page every 5 seconds and retrieve the notification

facebook like notifications with tornado, mongodb

I have an app that has facebook login. The users have an action which affects other users. I’d like the affected users to be notified in real time, if they are logged in, otherwise they should see the

how facebook notifications work?

I want to understand how facebook notifications work. When someone like your posts, comments, send message, etc, facebook sends a notification as soon as the event done. I want to know if there is any

Answers

Facebook uses a messaging protocol (which it designed) called Thrift. This allows notifications from clients to servers with very low latency. I would imagine updates on the server would be triggered depending on the user action and relevant users that are logged in would be notified by the same mechanism.

Using a messaging protocol such as thrift (also see Protocol buffers) clients don’t have to poll the server for updates, instead the server can push notifications to clients. To do this the server needs to have a notion of who is logged in at any one time (Login, logout handshaking) and of them, who should receive notifications from a particular client action.

Easier said than done, especially when you have 800 million potential users logged in!

Since your question is tagged with C#, ASP.NET you should use the awesome SignalR library. Basically SignalR enables you to send push notifications to the clients. Which exact underlying technique it uses is influenced by the capabilities of the Server and the Client.

There is a big real time chat site called jabbR that is built on top of SignalR:

http://jabbr.net/

Here are some more links that should get you started.

You might want to take a look at http://nodejs.org/ – it is an event-driven model which is perfectly ideal for a ‘social network’ / instant notifications scenario.

FYI: You also might find that using a non-SQL database such as MongoDB (http://www.mongodb.org/) will be a lot faster when querying from the DB since each ‘person’ object in a social network scenario has his/her own unique attributes – which in a normal SQL database is hard to design.