You get notification for new answers and stuff in SO. (The red mark next to StackExchange at the top)

The notification mark appears even if user doesn't interact with the browser(no reloading). 

How can I implement such a feature?