javascript - webdis connection time for second client -
i using webdis (https://github.com/nicolasff/webdis) ran webdis directed in website , included following javascript code 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 open connection in web page , opens 2 tabs, takes secondly opened tab 10 seconds start subscribing , listening messages published. there anyway reduce wait time second client connect , make instant? add?
Comments
Post a Comment