node-SseStream
. It just changes the header that the server uses for caching.
Note this is a direct fork of More info on this change:
The header 'Cache-Control': 'no-transform'
is needed for proxies that interfere with the request (such as caching). This was the case with the create-react-app
, when proxying requests to the dev-server backend to your real backend. See this issue: https://github.com/facebook/create-react-app/issues/1633#issuecomment-291353470 . Maybe this header isn't always desired, but I didn't know a good way to make this configurable other than passing a 3rd argument to this pipe
function, or maybe an extra parameter to the constructor allowing users to overwrite some of these headers if they want.
SseStream
A node stream for writing Server-Sent Events
Installation
npm install ssestream-no-cache-transform
Or:
yarn add ssestream-no-cache-transform
Usage
In a (req, res)
handler for a request
event, Express #get route or similar:
const SseStream = { const sse = req sse const message = data: 'hello\nworld' sse}
Properties on message
:
data
(String or object, which gets turned into JSON)event
id
retry
comment