Javascript 第二个客户端的webdis连接时间
我正在使用webdis(),我按照网站中的指示运行了webdis,并包含以下用于连接的javascript代码:Javascript 第二个客户端的webdis连接时间,javascript,php,webdis,Javascript,Php,Webdis,我正在使用webdis(),我按照网站中的指示运行了webdis,并包含以下用于连接的javascript代码: var previous_response_length = 0 xhr = new XMLHttpRequest() xhr.open("GET", "http://localhost:7379/SUBSCRIBE/hello", true); xhr.onreadystatechange = checkData; xhr.send(null); function checkDa
var previous_response_length = 0
xhr = new XMLHttpRequest()
xhr.open("GET", "http://localhost:7379/SUBSCRIBE/hello", true);
xhr.onreadystatechange = checkData;
xhr.send(null);
function checkData() {
if(xhr.readyState == 3) {
response = xhr.responseText;
chunk = response.slice(previous_response_length);
previous_response_length = response.length;
console.log(chunk);
}
};
当我在网页中打开连接并打开两个选项卡时,第二个打开的选项卡大约需要10秒钟才能开始订阅和收听发布的消息。是否有任何方法可以减少第二个客户端连接的等待时间并使其立即生效?有什么我可以补充的吗