Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Basically I would like to know how apps such as hotmail receive emails in realtime, without making periodic checks on the server - I've sent an email to myself from outlook with hotmail open and saw this in the console a couple of seconds later -

GET http://sn108w.snt108.mail.live.com/mail/messageshelper.mvc

the contents of which is the html to update, but I'd like to know what listens for the get request which presumably fires some javascript to update the dom?

My question isn't specific to hotmails methodolgy in fact far from it as they will be working on the .NET platform whereas my proficiencies (if you can call them that!) are in the LAMP stack but any reading material on the subject would be great, thanks!

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

There are many many ways to achieve something like this.

  • You can use WebSockets - for real time communication.
  • You can use polls - 'ping' the server every N seconds asking if there has been a change and update accordingly.
  • Use long polling.
  • Use Comet implementation (very hard to do)
share|improve this answer
    
Thank you, after some brief reading WebSockets is exactly what I wanted –  Keir Lavelle Aug 14 '12 at 16:48
add comment

In modern browsers this is typically done with WebSockets. In older browsers it can be done with long polling.

I've read that WebSockets is what's used on this site for the live updating of lists, edits, reputation, etc.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.