appfeel / node-pushnotifications

Push notifications for GCM, APNS, MPNS, AMZ (automatic detection from device token)
MIT License
534 stars 126 forks source link

switch environment during run time #104

Closed andrewvmail closed 5 years ago

andrewvmail commented 5 years ago

aside from creating two instances of the library is there a way to use dev and prod environment during runtime without restarting the server?

miqmago commented 5 years ago

Never tried but this should work:

import PushNotifications from 'node-pushnotifications';

const settingsDev = {...};
const pushDev = new PushNotifications(settingsDev);
const settings = {...};
const push = new PushNotifications(settings);

pushDev.send([...], {...});
push.send([...], {...});

Please reopen with your comments if it does not work.