Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

servant-event-stream 0.3.0 #7

Merged
merged 11 commits into from
Sep 5, 2024
Merged

servant-event-stream 0.3.0 #7

merged 11 commits into from
Sep 5, 2024

Conversation

bflyblue
Copy link
Owner

@bflyblue bflyblue commented Sep 5, 2024

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, ...]

- dropped dependency on servant-js, as it depends on servant <0.20:

  * jsForAPI was removed

- dropped dependency on servant-pipes

  * prefer use of SourceIO rather than depend on a particular implementation using pipes

  * eventSource changed from `eventSource :: Pipes.Proxy X () () ServerEvent IO () -> EventSourceHdr`
    to `eventSource :: EventSource -> EventSourceHdr`

- bumped pinned versions using niv for nix
@bflyblue bflyblue merged commit 08d4d6f into master Sep 5, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant