Atmosphere/atmosphere — Issue #200: Json data that I pass using atmosphere sometimes is corrupted
Author: xserge
Created: 2012-02-29 13:36:33+00:00
State: open

Hello, I found error on runtime.

My configuration:
Atmosphere 0.8.5,
Firefox 10.0.2
glassfish-3.1.2-web-b23

In my application I send json data from serverside to browser.
I noticed that sometimes I can't parse json data on a client because data is periodically corrupted.
The problem appears in two variants:

1. sometimes data that passed in atmosphere callback concatenates two json results. Just after one set of json data
goes next set of json data in one parameter of atmosphere callback. And $.parseJSON() parses this data with error.
During debugging I found that in that case something wrong with variable request.lastIndex on atmosphere javascript sources
response.responseBody = responseText.substring(request.lastIndex, responseText.length);

2. sometimes data that passed in atmosphere callback is cutted somethere in middle.
During debugging of atmosphere javascript sources I found that corrupted data received on that line
line:330 var responseText = ajaxRequest.responseText;
So XMLHttpRequest object returns cutted data. (but may be it is sideeffect of debugging)