We have a Apache server that provides a website. The website creates a GET-Request, that runs a C++ program on the server. The program creates a 3D-Scene and answers the Get-Request with a json containing the scene. The scene is then rendered in the browser using WebGL.
This works perfectly fine for small scenes.
Chrome throws an error when the json is greater than ~125 mb. Firefox can handle jsons up to ~260 mb.
I create the Get-Request using jquery:
BP2011D1.ServerProxy.prototype.loadMesh = function(requestParameter, callbackOnSuccess, callbackOnError)
{
$.ajax({
type: "GET",
url: this.getServerURL() + "/cgi-bin/" + this._treemapDirectory + "/hpi_bp2011_app_fcgi",
data: requestParameter + "&functionName=getMesh",
dataType: "json",
success: callbackOnSuccess.execute,
error: callbackOnError.execute
});
};
For large jsons the callbackOnError is executed, so the json seems to be invalid.
I know that the json should be perfectly valid.
I think that the browser cannot handle a big json or a big string. He clips some of the characters at the end, so the missing brackets make the json invalid.
Is there a way to handle the problem? I need to handle a json up to 800 mb.
You could try using a more compact format
http://code.google.com/p/webgl-loader/
You could also roll your own format and download the large parts directly in binary by using binary XHR
http://www.html5rocks.com/en/tutorials/file/xhr2/