<div dir="ltr">Hi all!<div><br></div><div>I&#39;ve just implemented a lightweight java client for receiving push messages from AeroGear WebPush Server [1]. It is easy to use and fully async!</div><div><br></div><div>A few words about decision to use Jetty as a HTTP/2 client:</div><div><br></div><div>Currently there are only 3 Java libraries, which implement client side of HTTP/2 protocol [2]: Netty, Jetty and OkHttp. I tried all of them:</div><div><ul><li>First of all I tried to use OkHttp. This is a lightweight http client for Android and other Java apps. But currently this library supports HTTP/2 protocol only via old HTTP/1.1 API. It works well for simple request-response, but its client API does not allow to use HTTP/2 features, like Server Push Frames. I looked at GRPC [3], because Googlers use OkHttp for HTTP/2 transport. But they don&#39;t use public API, they use only inner classes to handle frames and built their own logic atop this classes. It would be too complicated for our purposes.</li><li>Secondary, I tried to refactor our WebPush console to a client library. But this way is complicated too. netty-codec-http2 does not provide a client API, it is only codec, low level protocol implementation.</li><li>Now I use jetty-http2-client. It is easy to configure and use, fast and async. Jetty provides a user friendly API to handle HTTP/2 streams and get PUSH_PROMISE frames.</li></ul><div>For more information, look at my commit history.</div><div>In the future, if there will be more lightweight alternatives than Jetty (for example, new version of OkHttp or Java 9 API), I will rewrite the transport layer of my library.</div><div><br></div><div>Here is an example, how to use my library [4].</div><div><br></div></div><div>[1] <a href="https://github.com/idelpivnitskiy/aerogear-webpush-java-client">https://github.com/idelpivnitskiy/aerogear-webpush-java-client</a></div><div>[2] <a href="https://github.com/http2/http2-spec/wiki/Implementations">https://github.com/http2/http2-spec/wiki/Implementations</a><br clear="all"><div>[3] <a href="https://github.com/grpc/grpc-java/tree/master/okhttp">https://github.com/grpc/grpc-java/tree/master/okhttp</a></div><div>[4] <a href="https://github.com/idelpivnitskiy/aerogear-webpush-java-client/blob/master/src/example/java/org/jboss/aerogear/webpush/Example.java">https://github.com/idelpivnitskiy/aerogear-webpush-java-client/blob/master/src/example/java/org/jboss/aerogear/webpush/Example.java</a></div><div><br></div><div>Best regards,<div>Idel Pivnitskiy</div></div>-- <div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div>E-mail: <a href="mailto:Idel.Pivnitskiy@gmail.com" target="_blank">Idel.Pivnitskiy@gmail.com</a></div></div><div>Twitter: <a href="https://twitter.com/idelpivnitskiy" target="_blank">@idelpivnitskiy</a></div><div>GitHub: <a href="https://github.com/idelpivnitskiy" target="_blank">@idelpivnitskiy</a></div></div></div></div></div>
</div></div>