Closed
Description
Feature Request
Support for server-sent events in Tide apps.
Detailed Description
Support for working creating server-sent event streams, easily, with Tide.
Some more general server-sent events info:
- Standard: https://html.spec.whatwg.org/multipage/#server-sent-events
- Using Server-Sent Events: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
Context
I would like to use server-sent events. I suppose other folks might want to as well.
Possible Implementation
Ideally, I would be able to have some method on Response
or some sort of type that implements IntoResponse
that sets the Content-Type: text/event-stream
header for me, and takes a Stream<Item = ServerSentEvent>
where ServerSentEvent
is a struct with an optional event type string and a data string.
Maybe it would automatically send heartbeats too, to keep the connection alive?