h2soft / node-gcm

MIT License
68 stars 20 forks source link

Handle concurrency properly (fix #7) #8

Open Neamar opened 6 years ago

Neamar commented 6 years ago

When using the same instance of GCM to .send() in parallel, you'll only get one message id (or one error), since the function was relying on a single EventEmitter for all calls.

This PR makes the library works in parallel.

To maintain backward compatibility, I kept the .emit() behavior, even though the library itself isn't using it anymore.