Tell me, please, how often do they make an answer for the interlocutor?

That is, two users are rewritten, as in vk.com, for example. How should the script know that the second user sent the message?

As I understand it, just set a timer so that after a while he sends a request whether the second user responded or not.

Perhaps there are other options for getting an answer?

    2 answers 2

    This is called Comet technology .

    There are several ways:

    • pooling (constant requests that you specified)
    • long-pooling (long requests)
    • forever-frame (endless iframe)
    • XHR requests (it seems not to work everywhere)
    • webSocket (currently draft only)

    You can read something in more detail here or better search for more detailed information.

    • Advantages of WAMP compared to Comet: * implementation of the Pub / Sub pattern; * RPC and routed RPC; * open standard. - Sergiks 1:01 pm
    • polling. no there are no pools. - etki

    WAMP , which was an excellent report ( slides ) on the recent MoscowJS.

    It is decrypted not as Windows / Apache / MySQL / Php , but as Web Application Messaging Protocol :)