What are the ways to display 'chunked' responses as soon as they come into AngularJS?

余生长醉 提交于 2019-12-01 03:44:54

No example because I am not sure what you are using in terms of transport code/if you have a websocket available:

$http does not support doing any of the callbacks until a success code is passed back through at the end of the request - it listens for the .onreadystatechange with a 200 -like value.

If you're wanting to do a stream like this you either need to use $http and wrap it in a transport layer that makes multiple $http calls that all end and return a success header.

You could also use websockets, and instead of calling $http, emit an event in the socket.

Then, to get the chunks back the the client, have the server emit each chunk as a new event on the backend, and have the front-end listen for that event and do the processing for each one.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!