-
Notifications
You must be signed in to change notification settings - Fork 26
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
DeprecationWarning: OutgoingMessage.flush is deprecated. #28
Comments
I've removed the app.use(
compression({
filter: (req, res) =>
!res.getHeaders()["content-type"].includes("text/event-stream"),
})
); |
@cooper667, the more general solution would be to include |
In recent node, |
same problem here. seems incompatible. node just crashes |
Looks like there is already a pull request out there to handle |
It seems that there is not so much activity here right now. For people that are still looking for a solution for the res.flush() problem (TypeError: res.flush is not a function) and are not using the compression middleware for express.js. You can create a simple middleware function for express that adds the function. The following piece of code could maybe help some people:
This adds the empty function to res object and express-sse will not crash anymore. You can also just downgrade your express-sse package in This pull request would solve the problem i think. I hope this helps some people. |
@wiegvlieg , to reduce the workaround affect area, we can do it like this: app.get('/sse', (req, res, next) => {
res.flush = () => {};
next();
}, sse.init); |
this helped me thanks a lot |
Using the latest version of Node, I'm getting the following warning when a client is connected to the SSE endpoint and a server event is sent:
(node:16688) [DEP0001] DeprecationWarning: OutgoingMessage.flush is deprecated. Use flushHeaders instead.
I think this is likely related to commit 96723a0, which added
res.flush()
after the message is sent.The text was updated successfully, but these errors were encountered: