Handle chunked data sent by Play scala with AngularJs

南笙酒味 提交于 2019-12-03 13:48:42

问题


I send chunked data with Play Scala 2.2 to the client side like this : Ok.chunked(data)

I would like to use them as soon as they are available on the client side. If I just get the data and print them on .success, they are printed at the same time i.e. when the last data is received.

How can I print them as soon as they are received? Must I use websockets?


回答1:


Use streaming json library like http://oboejs.com/

Oboe.js is an open source Javascript library for loading JSON using streaming, combining the convenience of DOM with the speed and fluidity of SAX.

It can parse any JSON as a stream, is small enough to be a micro-library, doesn’t have dependencies, and doesn’t care which other libraries you need it to speak to.



来源:https://stackoverflow.com/questions/28710394/handle-chunked-data-sent-by-play-scala-with-angularjs

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