如何与QUOT;流" JSON从服务器到客户端使用的JavaScript [英] How to "stream" json from server to client using javascript

查看:76
本文介绍了如何与QUOT;流" JSON从服务器到客户端使用的JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Ajax和JSON,我可以发送一个请求,并得到一个解析一个JSON请求不够熟悉。理想情况下,我想接收多个响应定期更新进度条。这样,客户可以有一个积极的反馈。

I'm familiar enough with Ajax and JSON that I can send a request and get a parse a JSON request. Ideally I'd like to receive multiple response to periodically update a progress bar. This way clients can have a positive feedback.

我听说JSON数据流,但还没有找到如何实现一个很好的资源。有谁知道一个很好的资源,或如何做到这一点?

I've heard of JSON streams but have not found a good resource on how to implement this. Does anyone know of a good resource or how to do this?

推荐答案

JSON是数据要通过HTTP协议(如文本,HTML,PDF等),只是还没有另一种格式。你可能指的是 cometd

JSON is just yet another format of data going over the HTTP protocol (like text, html, pdf, etc). You are probably referring to cometd.

这允许你打开一个持久连接,并从服务器到客户端推送数据(即流式处理)。任何格式有效推动,客户端只需要了解它。

This allows you to open a persistent connection and push data from the server to the client (ie stream it). Any format is valid to push, the client just needs to understand it.

这篇关于如何与QUOT;流" JSON从服务器到客户端使用的JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆