Web Reactive Programming - What are the advantages from the HTTP client point of view?

寵の児 提交于 2019-12-02 23:11:33
Rossen Stoyanchev

There are differences so let me try to break it down.

For the DeferredResult<Double[]> return value clearly the array has to be prepared first before the value can be written to the response.

Spring Web Reactive does write each individual value from a Flux<Double> as it becomes available. Now from a browser perspective you may not see an actual difference because it won't give you the full JSON array until it's received in its entirety.

This is more a question of how to stream into a browser? For example if you add "Accept: text/event-stream" as a request header you can then consume each double as an individual event in the browser. So the capability of the server to do it and do it efficiently is there.

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