gpt4 book ai didi

http - 在 HTTP 中维护同时连接?

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:20:59 25 4
gpt4 key购买 nike

我需要维护与 Web 服务器的多个事件的长池 AJAX 连接。

我知道大多数浏览器不允许超过 2 个同时连接到同一服务器。这就是HTTP 1.1 protocol状态:

Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy. A proxy SHOULD use up to 2*N connections to another server or proxy, where N is the number of simultaneously active users. These guidelines are intended to improve HTTP response times and avoid congestion.

假设我有 2 个子域 Server1.MyWebSite.Com 和 Server2.MyWebSite.Com 共享相同的 IP 地址,我能否同时建立 2x2 连接?

最佳答案

看来同一 IP 上的不同主机名可以是 useful .由于 Same Origin Policy,您在建立 AJAX 连接时可能会遇到问题.

编辑:根据您的 document.domain 问题(来自 Google's Browser Security Handbook):

Checks for XMLHttpRequest targets do not take document.domain into account...

关于http - 在 HTTP 中维护同时连接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1235462/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com