Server push: comet vs ape?

后端 未结 8 1008
难免孤独
难免孤独 2021-02-15 16:24

I\'ve read a little about comet and also APE.

Which one is better? I want the users to see other users updated content. Like Google Wave.

And in comet, there are

8条回答
  •  余生分开走
    2021-02-15 16:47

    I think you want to compare IFrame based techniques with Ajax (XMLHttp) based techniques.

    I think the major difference is that you cannot read the response content of an AJAX request until the whole response is received by the browser. Which means, in order to simulate streaming, you will have to do something like this:

    1. Make a request to the server
    2. On getting a response read the response and make another request

    The server can hold on the request if there isn't anything to return yet.

    IFrame based solution on the other hand can return multiple script tags in response to a single request. There is no need to send another request until there is a (browser or server) request timeout.

提交回复
热议问题