Skip to content

Support streaming API resources as server-sent events

Latest
Compare
Choose a tag to compare
@arucard21 arucard21 released this 23 May 13:16
· 24 commits to master since this release

This release adds support for sending API resources as server-sent events. This can be used as an alternative to paging when you want to get all API resources. It also add support for receiving those API resources in the client.

This works by having the API set up a one-directional connection to the client, then sending each API resource (in JSON format) over that connection. Once all API resources are sent, an event marking the end of the collection is sent and the connection is closed.

This functionality requires implementing the stream() functionality. It is also strongly recommended to use HTTP/2 due to limitations with the amount of connections that can be made in earlier versions of HTTP.

Aside from this, the JSON field filter has been improved. It can now be done through a JAX-RS filter, instead of a servlet filter. This was necessary in order to apply the JSON field filter on the server-sent events, allowing you to filter the fields of the API resources sent as events. The servlet filter is now deprecated and will be removed in the future.