N
N
Nikolay2011-06-07 22:47:51
In contact with
Nikolay, 2011-06-07 22:47:51

"Audition" VKontakte servers

Hello Habrahabr!
Recently, on the VKontakte site, browsing it with Firebug turned on, I noticed something that remains a mystery to me. Hope you can help me figure it out.

And so, the essence is that on all pages of the site there is a request for 25 seconds that listens to the server for events. If a message arrives or someone wrote to you on the "wall", then the request is immediately completed, a notification is displayed and a new one is immediately launched.

Question: what server and client technologies are used for this :) I read about node.js, is it it?
Screenshot with firebug to make it clear what it is about - easycaptures.com/fs/uploaded/458/9381837811.jpg

UPD Header screen - easycaptures.com/fs/uploaded/458/3646484634.png

Answer the question

In order to leave comments, you need to log in

6 answer(s)
A
Anton, 2011-06-07
@Piterski

Such requests are generally called long polling. Ways to implement, I think, you yourself will already find or prompt here. For some reason, I have one of the associations with this - comet.

V
Vitaly Peretyatko, 2011-06-08
@viperet

It uses Long Polling as already mentioned. The mechanics is this - JS connects to the Web server, but the server does not immediately give an answer (if there is no data), but simply waits. If a message arrives that needs to be transmitted to the client, the server sends it. If there are no messages, then the client still reconnects to the server every 25 seconds - for reliability, pinging.
This can be implemented on the server side in different ways, for example, on nginx:
highload.com.ua/index.php/2010/07/21/use-nginx-as-long-polling-comet-server/

C
Carzil, 2011-06-07
@Carzil

No, on the client, this is not node.js, but ajax. On the server, most likely, PHP. You can find out by looking at the transmitted headers.

G
gabriell, 2011-06-07
@gabriell

Ajax every 25 seconds knocks on the address that passes the parameters and if they are not empty, custom jGrowl is displayed

F
fso, 2011-06-08
@fso

Yes, as you were told above, this is a long polling comet. IMHO, the simplest mechanism that allows you to implement slow queries is Dmitry Koterov's DkLab_Realplexor. I would advise studying "live" to start with him. Written on pearl. Examples and descriptions are available at http://dklab.ru/lib/dklab_realplexor/

J
joger, 2011-06-08
@joger

and for what purposes? and then there is also the socket.io library. for the "wall" it is a bit heavy, but for reak-time

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question