Open
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the feature has not already been requested
🚀 Feature Proposal
I would like this module to support server-sent events (SSE).
(If helpful, I can submit a pull request.)
Motivation
Currently, the best way to test SSE doesn't use this package at all. It seems the state-of-the-art is to start the server and use an EventSource
, possibly with the eventsource package. This works but requires the server to be active, which this module tries to avoid.
It would be nice if this package had an answer for testing SSE.
This was briefly discussed in #105.
Example
There are several possible ways this API could be implemented. My favorite idea is a re-implementation of the W3C EventSource
; something like this:
const source = new inject.EventSource(dispatch, { path: '/my-events' })
source.onmessage = (event) => {
console.log(event)
if (event.data === 'please close') {
source.close()
}
}
But there are many possible options, which we can discuss (if we even want to implement this feature at all!).
Metadata
Metadata
Assignees
Labels
No labels