This post has been brewing for a while but I finally took some time to finish it.

Ever wondered how you can do a push from your backend when on HTTP/2? Server-Sent Events is the answer to that. I wrote a piece on how it works and how to do it.

Read how to implement it both on backend (Spring Boot) and on Android.

https://www.hellsoft.se/implementing-server-sent-events/

Implementing Server-Sent Events with Spring Boot and Android

With HTTP/2 we can no longer use Web Sockets, so when we need to push data from the client to the server we need an alternative way. This is where Server-Sent Events come in. In this post, I will show how to implement it both in the backend, using Spring Boot, and on an Android client.

Hellsoft
@ErikHellman HTTP/2 has a standard for web sockets which uses a single stream of the protocol over the same TCP connection which is handling normal request/response pairs. https://www.rfc-editor.org/rfc/rfc8441
RFC 8441: Bootstrapping WebSockets with HTTP/2

@jw Yeah, I was made aware of this from a friend once I posted. Will update my post with that info. :)

It's implemented in Chrome and Firefox, but status unknown for Safari (https://chromestatus.com/feature/6251293127475200).

Node 19, .NET 7, and Jetty 10 seems to have support for it on the server-side.

OkHttp lacks support though, and iOS support is also missing.

Chrome Platform Status