atmosphere icon indicating copy to clipboard operation
atmosphere copied to clipboard

[jQuery] - streaming, junk issue

Open PavelR577 opened this issue 14 years ago • 3 comments

it looks like when the junk will be broadcasted in chunks it will break the logic of the junk remove

PavelR577 avatar Aug 16 '12 07:08 PavelR577

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.

xenster86 avatar Aug 20 '12 14:08 xenster86

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

PavelR577 avatar Aug 21 '12 08:08 PavelR577

@poi212003 Thanks! It started to work fine in chrome.

xenster86 avatar Aug 21 '12 09:08 xenster86