batch http requests

后端 未结 7 1907
[愿得一人]
[愿得一人] 2021-02-01 06:31

Does anyone know a standard way to batch http requests? Meaning - sending multiple http atomic requests in one round trip?

We need such mechanism in our REST API implem

相关标签:
7条回答
  • 2021-02-01 07:28

    There's an official HTTP way to do that which is called HTTP Pipelining. But you may have more problems with the browser side than with the server-side. So you may be able to use it if you have a hig-level of control on the client side only.

    XHR does not always allow pipeling, and AFAIK you have no control of the HTTP tunneling with Javascript. So a basic ajax-jQuery implementation cannot exists. But you may find some advanced things with Comet and the Bayeux protocol, emulating bi-directionnal long-term tcp-connections, where you will certainly reduce the tcp round trips.

    I'm not a comet specialist, but you may find useful informations on this Comet & HTTP Pipeling article, to my understanding most of this is highly experimental, but at least you could have a nice fallback with 'classical' comet when HTTP Pipelining is not available. This would maybe need a retag or a new question.

    0 讨论(0)
提交回复
热议问题