简体   繁体   English

使用OkHttp通过服务器推送读取响应

[英]Read response by server push with OkHttp

I am making a simple Android app to test the response from the server which support SPDY Server Push. 我正在制作一个简单的Android应用程序来测试来自支持SPDY Server Push的服务器的响应。 I've started with the testing site , which should be able to push the rest of resources automatically after issuing the first HTTP request to the page. 我已经开始使用测试站点 ,该站点应该能够在向页面发出第一个HTTP请求后自动推送其余资源。

I just come across the OkHttp and would like to know whether it already supports accepting the server push stream. 我刚刚遇到OkHttp并想知道它是否已经支持接受服务器推送流。 If yes, how could I obtain the input stream for the "responses" which are not requested directly? 如果是,我如何获得未直接请求的“响应”的输入流?

Thanks! 谢谢!

Currently, pushed data is put directly into the HTTP response cache for future requests. 目前,推送的数据直接放入HTTP响应缓存中以供将来请求使用。 This means that subsequent requests for the pushed content can skip the network. 这意味着对推送内容的后续请求可以跳过网络。

In version 2, there will be a public API for handing these server pushes at the application level. 在版本2中,将有一个公共API用于在应用程序级别处理这些服务器推送。 Expect to see that version in a few months from now. 期待在几个月内看到该版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM