OkHttp是否支持HTTP/2服务器推送? [英] Does OkHttp support HTTP/2 server push?

查看:384
本文介绍了OkHttp是否支持HTTP/2服务器推送?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用OkHttp库和HTTP/2开发一个Android视频流应用程序.我正在研究使用HTTP/2协议的服务器推送功能的可能性,但是我不确定OkHttp是否支持它.

I am developing an Android video streaming application using the OkHttp library and HTTP/2. I am investigating the possibility of using the server push functionality of the HTTP/2 protocol, but I am not sure whether OkHttp supports it or not.

我有一个用于测试HTTP/2推送的基本服务器实现,在chrome浏览器上可以正常工作(即,推送的内容存储在缓存中,并由浏览器从缓存中检索).当我将Android应用程序与OkHttp库一起使用时,内容不再被推送到客户端的缓存中(顺便说一句,该缓存已初始化并可以正常工作).特别是,客户端会针对服务器要推送的每个内容,向服务器发送重置流.

I have a basic server implementation to test HTTP/2 push, which works without problems on the chrome browser (i.e., pushed content is stored in the cache and retrieved from the cache by the browser). When I use the Android application with the OkHttp library, content is not pushed anymore to the client's cache (which is initialized and working properly, by the way). Particularly, the client sends a reset stream to the server for each content the server would like to push.

您是否知道OkHttp是否支持推送流?如果它确实支持服务器推送,是否有最佳实践来使其正常工作?预先感谢您的回答.

Do you have any idea if OkHttp supports push streams? And in case it does support server push, are there any best practices to make it work? Thanks in advance for your answers.

推荐答案

目前没有任何内容.我们正在重写缓存持久性,这是一项巨大的努力.如果您想阅读内部信息,则可以使用它的回调函数,但是它们当前仅会取消推送的流.

Nothing currently. We’re rewriting the cache persistence and that’s a big effort. If you want to read the internals there’s callbacks for it, but they currently just cancel the pushed streams.

这篇关于OkHttp是否支持HTTP/2服务器推送?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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