What TCP protocols can be used for client-client interaction?

Many clients request features such as instant messaging (IM) and other client-to-client interaction (P2P) for their web applications. Generally, how is this done in regular web browsers? For example, I saw demos of Google Wave (and Gmail) that can use IM from a regular browser. Is it through HTTP? Or does XmlHttpRequest (AJAX) provide the necessary backend for such communication?

What interests me most is how the server can wake up on a remote client, say, to send IM? Or should the client "poll" the message server for new instant messages?

+1
source share
1 answer

Typically, the browser checks the server for new messages. One approach that is often done to increase efficiency is long poll '(see also this link ) - the server responds immediately if it has anything; otherwise, it waits until the connection is open. If a message arrives, he immediately wakes up and sends it, otherwise he returns with "no, checks back" in a few tens of seconds. The client immediately dials the number to return to the state of a long survey.

+3
source

Source: https://habr.com/ru/post/1714537/


All Articles