-
Breaking changes to the API.
Event streams are implemented using servant's 'Stream' endpoint. You should provide a handler that returns a stream of events that implements 'ToSourceIO' where events have a 'ToServerEvent' instance.
Example:
type MyApi = "books" :> ServerSentEvents (SourceIO Book)
instance ToServerEvent Book where toServerEvent book = ...
server :: Server MyApi server = streamBooks where streamBooks :: Handler (SourceIO Book) streamBooks = pure $ source [book1, ...]
- Import
Data.Semigroup
for base < 4.11.0
Servant.EventStream
was moved toServant.API.EventStream
to adhere existing upstream layout.
- First version. Released on an unsuspecting world.