express-sse icon indicating copy to clipboard operation
express-sse copied to clipboard

Flush not a function error using node-js version 14.15.x

Open shofmannka opened this issue 4 years ago • 4 comments

With the current LTS node-js version i get the error measure uncaughtException: res.flush is not a function\nTypeError: res.flush is not a function\n at SSE.dataListener ...

shofmannka avatar Dec 10 '20 15:12 shofmannka

Same problem at: node -v : v14.9.0 npm -v : 6.14.8 "express": "4.17.1" "express-sse": "0.5.3"

possible solutions:

  1. revert to "express-sse": "0.5.1"
  2. add "compression": "1.7.4" to the dependencies * after "const app = express();" also add "app.use( compression() );" * I guess internally this will work similar to https://github.com/expressjs/compression#server-sent-events

I would appreciate a fix.

sqrt10 avatar Feb 21 '21 00:02 sqrt10

Also problematic for v16.6.1

Utopiah avatar Aug 29 '21 17:08 Utopiah

Feel free to install my fork instead as it has this fix.

npm i github:omgimalexis/express-sse

https://github.com/OmgImAlexis/express-sse

OmgImAlexis avatar Dec 27 '21 01:12 OmgImAlexis

Feel free to install my fork instead as it has this fix.

Thank you! When I tried yours with const sse = new SSE(); error: SSE is not a constructor. I had to use const SSE = require('express-sse').SSE; instead and then it worked. Just FYI for others.

SinisterSpatula avatar Jan 07 '22 05:01 SinisterSpatula