Comet VS Ajax polling

后端 未结 3 658
夕颜
夕颜 2020-12-08 23:48

I need to create a chat like facebook chat.

With Comet I need more memory to keep the connection.

With Ajax polling there is a latency problem if I send requ

3条回答
  •  失恋的感觉
    2020-12-09 00:27

    Latency is not the only problem. COMET (long-polling) "saves" your traffic - when you use polling, you cannot know, if there were changes on the server, so some of the calls may be just a waste of traffic and resources (e.g., even if no one's chatting, you're making calls every 3-4 seconds). In case of COMET, you generally need one just call to get an update from the server (with 100% hit rate).

提交回复
热议问题