1

I am using webdis (https://github.com/nicolasff/webdis) I ran the webdis as directed in the website and included the following javascript code to connect:

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);
}
};

When I open up the connection in a web page and opens up two tabs, it takes the secondly opened tab about 10 seconds to start subscribing and listening to messages published. Is there anyway to reduce that wait time for the second client to connect and make it instant? Anything I could add?

Jonatha Suh
  • 195
  • 13

0 Answers0