How Facebook chat is working?

前端 未结 2 1822
[愿得一人]
[愿得一人] 2021-02-13 19:54

How Facebook chat is working? Can anyone give me idea? I mean they are using websocket or AJAX? How they have implemented it?

2条回答
  •  走了就别回头了
    2021-02-13 20:24

    It's a comet (see wikipedia) model:

    Comet is a web application model in which a long-held HTTP request allows a web server to push data to a browser, without the browser explicitly requesting it. Comet is an umbrella term, encompassing multiple techniques for achieving this interaction. All these methods rely on features included by default in browsers, such as JavaScript, rather than on non-default plugins. The Comet approach differs from the original model of the web, in which a browser requests a complete web page at a time.

    Example of comet framework is APE. It is for javascript, however comet can be written not only in javascript.

提交回复
热议问题