如何做通知

I'm working on building a "social networking" site, basically theres a login and a forum where users can post, a gallery where you can upload pictures, send friend requests.

What I wanna do next is creating some kind of way a user can now someone has replied to a post they've made, if someone has sent them a friend request, tagged in a pic etc. Notifications.

This is kind of advanced to me so I felt I had to ask what would be the best way to do this, how do big sites do it?

Right now I'm thinking making a table "notifications"

id, user1, user2, type, link, have_read

And when for example I reply to a post by user Tom, I insert to that table

insert (Tom, Bob, 'post-reply', 'link to the post'

and if Tom sends Bob a friend request

insert (Tom, Bob, 'friend-request', 'link to where you can accept request'

You could add a Boolean "Notify" set to true once a request has been made.

If the Boolean is true you can add a notification bar which shows a message if the notify boolean is so to true