Can anyone explain how does the real time response works in Twitter ? Like when u search in twitter while viewing the result u get real-time updates saying "7 more people tweeted" . I have noticed there is no AJAX call being made. Can someone tell me how this works and is it possible to implement such a thing using PHP ?
+3
A:
Firebug shows that it is making asynchronous calls to the server:
Note the variables:
- q: "new year"
- since_id: 7199106684
- refresh: true
- callback processSummizeRefresh
All it's doing is looking for any matches to the q
variable whose ID is greater than since_id
and returning a count. If you load the results, by clicking "123 new tweets," the since_id
will be updated to reflect the new latest ID value.
Jonathan Sampson
2009-12-30 15:44:29
It has to query the server its understood. How does it do it without making any AJAX calls ?
Undefined
2009-12-30 15:52:01
It IS making ajax a calls. I pulled this information out of firebug.
Jonathan Sampson
2009-12-30 15:59:37
Okay finally found that it does make AJAX calls. Can you give me a reason why the AJAX call made, does not get logged into the console tab of firebug. Coz most of the applications I seen, all the AJAX calls get logged into the console tab of firebug, in twitters case it isnt so?
Undefined
2009-12-30 16:16:09
If you open firebug after you've already loaded the page, I think it may not capture future asynchronous traffic. Try going to the page with firebug opened, then refresh the page.
Jonathan Sampson
2009-12-30 21:04:22
+2
A:
It's all about comet, as mentioned by Zack. Implementations in PHP are tricky; Facebook uses Erlang.
If you want to get started with PHP without the hassle of setting up your own server, check out WebSync On-Demand.
jvenema
2010-03-22 14:54:59