How is youtube comments feature implemented?
How is youtube comments feature implemented? I see that they use AJAX but they don't do AJAX calls every second or two.Ajax call is made when there is a new comment on the video. On my page I call a page every 5 seconds with AJAX. So how开发者_Python百科 are they doing that?
Personnally when i have a look at Firebug to see Ajax Request, i have one who's called every 2-3 seconds with parameters :
asv 3
ctp 2
docid DbYtqAWDF2U
el detailpage
et 20.087
fmt 34
ns yt
plid AASgAO8pqC5GDlo9
st 20.087
vid VcyzE1TkaJrg4jlA8I_rWIK6z2TaXNB3R
yttk 1
docid is just the id of the video, $_GET['v'] var too.
It uses Ajax and if you see the content of the ajax call it contains poll_delay value which is something like 60,000 which means when it has to poll the live comments again.60 seconds in this case.
精彩评论