Pregunta

Maybe the title could be rephrased slightly better but basically I'm wondering how the likes of facebook have implemented a 'live' interface with regards to new notifications/messages etc. I know that the complexity behind such a social network is too much to discuss in this one small SO thread but if anyone has any idea as to the technologies used in order to notify it's users almost immediately of new records (I'm assuming DB records) then I'd be curious to hear it.

If I were to guess, I'd say that there were timers on client-side code that would periodically check the database via AJAX and then react accordingly. Is this right?

¿Fue útil?

Solución

It is via Comet and long polling via node.js or similar non-thread based web servers.

If I were to guess, I'd say that there were timers on client-side code that would periodically check the database via AJAX and then react accordingly. Is this right?

You are partially right. The client opens a connection and the server only responds once it has something to return to the client.

Otros consejos

I think they are trying to use HTML5 WebSockets but as a fallback they using Comet, AJAX, Long pooling with a good backend.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top