Reputation: 4770
Is there any way I can use server-sent events in a native Android app?
Upvotes: 4
Views: 957
Reputation: 1875
You can, but you'll have to implement the parsing, reconnecting, and other parts of the spec yourself.
This isn't too onerous; you'll need to build on top of an http library that lets you process bytes as they come in over the wire. I've built a Python library that parses SSE streams, and is build on Requests. You should be able to write something similar in Java.
Upvotes: 2