A data intensive intranet application uses the following angularjs
post function. It calls a Web API service returning a large JSON object in a chunked stream. This works perfectly well for responses of 100Mb but fails when the response reaches about 250 Mb.
$scope.refresh = function (){
usSpinnerService.spin("main-grid");
$http.post('/api/Assets/GetLargeJSONResult', $scope.postPayload
).then(
function successCallback(response) {
$scope.mainGridOptions.api.setRowData(response.data);
$scope.mainGridOptions.api.refreshView();
clearErrorMessage();
},
httpErrorCallback)
.then(refreshGridTwo)
.finally(function () {
usSpinnerService.stop("main-grid");
});
};
Putting a breakpoint on the line $scope.mainGridOptions.api.setRowData(response.data);
shows that response.data
is an empty string.
Everything else works fine. I've tried various different ways of returning the JSON response from the web server and so I doubt the problem is on the server end. I'm targeting the Chrome browser in Windows.
Relevant request headers:
- Accept: application/json, text/plain, /
- Accept-Encoding: gzip, deflate, br
- Accept-Language: en-US,en;q=0.8
- Connection: keep-alive
Relevant response headers
- HTTP/1.1 200 OK
- Cache-Control: no-cache
- Transfer-Encoding: chunked
- Content-Type: application/json
- Expires: -1
I know one option would be to page the response into smaller chunks. However, I would prefer to keep the data intact as it's being analysed in a grid. I wondered if I'm missing something as I can successfully stream very large open office xml files (media type "application/octet-stream") to the browser from Web API without any issues.