`MaxListenersExceededWarning` on using `tailFile.on` inside `socket` connection
(node:4068) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 update listeners added to [TailFile]. Use emitter.setMaxListeners() to increase limitnew event listners (
tailFile.on('update')
) are created whenever new socket connection is established, causing the above warning. what could be better wat to handle this? TailFile
class extends events.EventEmitter
.
1 Reply
some more information that might help:
- i will only push
update
data to connections, and won't receive any from them
- every new connection will be sent init
data, and thereafter only update
data