问题
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.
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.
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.
回答1:
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.
来源:https://stackoverflow.com/questions/40187251/does-okhttp-support-http-2-server-push