Eneris / push-receiver

A library to subscribe to GCM/FCM and receive notifications within a node process.
https://medium.com/@MatthieuLemoine/my-journey-to-bring-web-push-support-to-node-and-electron-ce70eea1c0b0
MIT License
16 stars 15 forks source link

Fix onReady listener leak #1

Closed djm181 closed 2 years ago

djm181 commented 2 years ago

The connect method adds a new listener to the ON_READY event, but never removes that listener. Since connect is called again in the socket retry logic, a long-running application may trigger the max-listeners warning in node by continuously re-adding the promise listener.

This change disposes of the listener once it has been triggered to prevent this leak.

Eneris commented 2 years ago

Hi. Really sorry for the long response. Must have missed the alert. Look segit. I'll do some tests and merge it.

Thanks for your PR