Issue
We have REST API client \ server service. In a specific post request, the server should start a long running operation and the client should wait and receive a progress notification until the operation is done. The progress notification is a simple json strings messages that should be visible to the user immediately when the server sends it.
The server sending a chunked JSON strings during the operation.
How should i react to received chunked data (from a post request) immediately when thy arrive? I'm using Angular 6, and i tried different techniques , with no successful results.
I have tried to set the httpClient option "reportProgress" to true, it just splits the response to different progress reports, but it still collects all the server chunks to single array buffer.
I have also tried creating an HttpInterceptor, i gotthe same "split" of the response, but not the actual server chunks.
Solution
I figure it out:
Using the XMLHttpRequest, register to the progress events and set the content type in the server node code to text/json
.
The progress events fired on each server chunk data.
Answered By - Eyal L
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.