使用HTTP Post从客户端流式传输数据 [英] Streaming data from client with HTTP Post

查看:1424
本文介绍了使用HTTP Post从客户端流式传输数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将数据从客户端流式传输到服务器。

I would like to stream data from the client to the server.

我的应用程序将音频数据流式传输到服务器。我不知道当我开始流式播放音频时会有多长时间。我希望通过在记录数据时传输数据来减少延迟。一旦上传了所有数据,我就会处理它。

My application streams audio data to the server. I do not know how long the audio will be when I begin streaming it. I want to reduce latency by transmitting the data as it is being recorded. Once all the data has been uploaded, then I will process it.

所以,我想要的是一个HTTP POST,身体是流式传输的。在客户端,POST将在数据可用时发送。在服务器端,我希望它像普通的POST一样到达,并带有完整的收集数据。

So, what I would like is a HTTP POST where the body is streamed. At the client, the POST would be sent as the data is available. At the server end, I would like it to arrive like a normal POST with a complete body of collected data.

我目前正在使用Restlet,并将我的流作为Chunked POST实现到Restlet框架。

I am currently using Restlet, and implementing my stream as a Chunked POST to the Restlet framework.

但是,我找不到允许我开始POST的客户端API,然后开始流式传输数据。

However, I can not find a client API that allows me to begin the POST, then start streaming the data.

我没有找到任何有用的搜索存档。任何人都可以给我一个指针。可以通过这种方式使用HTTP POST吗?我可以使用Restlet吗?是否有其他标准模式/ API用于从客户端流向服务器?

I haven't found anything useful searching the archive. Can anyone give me a pointer here. Can HTTP POST be used this way? Can I use Restlet for this? Is there another standard pattern/API for streaming from the client to the server?

非常感谢提前
Peter

Many thanks in advance Peter

推荐答案

为那些后来的人回答我自己的问题。

Going to answer my own question for those that come after.

这是关于流请求的一个很好的教程使用Apache HttpClient

Here is a nice tutorial on streaming requests with Apache HttpClient

搜索请求流式传输:

http://hc.apache.org/httpclient-3.x/performance.html#Request_Response_entity_streaming

这篇关于使用HTTP Post从客户端流式传输数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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