k-yle / rtsp-relay

📽 View an RTSP stream in your web browser using an express.js server
https://npm.im/rtsp-relay
MIT License
312 stars 58 forks source link

streamIn.stdout.off is not a function #216

Closed ptorrent closed 1 year ago

ptorrent commented 1 year ago

Hello there !

THanks for your job, that's awesome

Just have this issue when I close the client:

/home/pi/node_modules/rtsp-relay/index.js:184
          streamIn.stdout.off('data', onData);
                          ^

TypeError: streamIn.stdout.off is not a function
    at WebSocket.ws.on (/home/pi/node_modules/rtsp-relay/index.js:184:27)
    at emitTwo (events.js:131:20)
    at WebSocket.emit (events.js:214:7)
    at WebSocket.emitClose (/home/pi/node_modules/ws/lib/websocket.js:246:10)
    at Socket.socketOnClose (/home/pi/node_modules/ws/lib/websocket.js:1148:15)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at TCP._handle.close [as _onclose] (net.js:554:12)

Maybe use removeListener for old node verison ?

Thanks for your support !

k-yle commented 1 year ago

Hi, EventEmitter#off was added in nodejs v10, so you must be using nodejs v9 or older. Nodejs v9 stopped receiving security updates over 5 years ago, so I would strongly suggest upgrading to v20

ptorrent commented 1 year ago

Hello yes I know, but on some of our devices node 8+ is not supported. I will change the off to removeListener... that's not a big security change for keeping compatibility.

Thanks you answer !