Multiple Push notificatons gateways
Administration -> Settings -> Push -> Gateway If I set multiple push notification gatways rocketchat server send only to first one (Multiple lines can be used to specify multiple gateways)
Beсause: https://github.com/RocketChat/Rocket.Chat/blob/develop/apps/meteor/app/push/server/push.ts#L270 in private async sendNotificationGateway(
in such "for" logics will work only one time and will exit from a "for" loop after first "return this.sendGatewayPush..." and will not try next gateway from a "this.options.gateways" list.
`for (const gateway of this.options.gateways) { logger.debug('send to token', app.token);
if ('apn' in app.token && app.token.apn) {
countApn.push(app._id);
return this.sendGatewayPush(gateway, 'apn', app.token.apn, { topic: app.appName, ...gatewayNotification });
}
if ('gcm' in app.token && app.token.gcm) {
countGcm.push(app._id);
return this.sendGatewayPush(gateway, 'gcm', app.token.gcm, gatewayNotification);
}
}`
Fixed with slight logic improvement
I have referred this to the team but not sure what their view will be on this.
Please be patient.
Can you please open a Pull Request with the fix you are proposing? Please, make sure to check our guideline here
Fixed with slight logic improvement
Make a proper PR as requested please
This is not an issue since it is impossible to have once device that has an apn and a gcm token, for that to happen a device would have to be android & IOS.
Hi It is not related to iOs or Android If I want to set my own gateway in a parappell of current. Under the filed we have tooltip: (Multiple lines can be used to specify multiple gateways)
Under the field we have tooltip: (Multiple lines can be used to specify multiple gateways)
Can you post a screenshot please?
Please reopen
This is not an issue since it is impossible to have once device that has an
apnand agcmtoken, for that to happen a device would have to be android & IOS.
If this is the case then this is a GUI issue and you should not be able to specify multiple gateways.
Re-opening as this should be fixed.
I'll ask Gustavo to check again
Fair, I'll test this when I get back. But Idk why it would make sense to support more than one gateway