How does Facebook chat avoid continuous polling of the server? [closed] How does Facebook chat avoid continuous polling of the server? [closed] json json

How does Facebook chat avoid continuous polling of the server? [closed]


Facebook uses a technique which is now called Comet to push messages from the server to the client instead of having the client poll the server.

There are many ways that this can be implemented, with XMLHttpRequest long polling being just one option. The principle behind this method is that the client sends an ordinary XMLHttpRequest but the server doesn't respond until some event happens (such as another user sending a message), so the client is forced to wait. When the client receives a response (or if the request times out) the client simply creates a new request so that it always has one open request to the server.