atmosphere
atmosphere copied to clipboard
[jQuery] - streaming, junk issue
it looks like when the junk will be broadcasted in chunks it will break the logic of the junk remove
Having the similar issue. It is reproducible when connection is done using remote host with high ping delay. Sometimes during initial handshake ' Welcome to the Atmosphere Framework' is not delivered fully and onMessage callback is being invoked with wrong text.
@werdex - I solved it this way (incase you want to use my solution):
Just add a junkFull:false to the _response object and add this fix
if (rq.transport == 'streaming') {
var text = responseText.substring(rq.lastIndex, responseText.length);
_response.isJunkEnded = true;
//fix junk is comming in parts
if (!_response.junkFull && (text.indexOf("<!-- Welcome to the Atmosphere Framework.") == -1 || text.indexOf("<!-- EOD -->") == -1)) {
return;
}
_response.junkFull = true;
//if it's the start and we see the junk start
//fix for reconnecting on chrome - junk is comming in parts
if (rq.lastIndex == 0 && text.indexOf("<!-- Welcome to the Atmosphere Framework.") != -1 && text.indexOf("<!-- EOD -->") != -1) {
_response.isJunkEnded = false;
}
@poi212003 Thanks! It started to work fine in chrome.