Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Multiple Push notificatons gateways

Open DustpaN-Spb opened this issue 1 year ago • 4 comments

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);
		}
	}`

DustpaN-Spb avatar Nov 22 '24 08:11 DustpaN-Spb

Fixed with slight logic improvement

arth-1 avatar Nov 22 '24 16:11 arth-1

I have referred this to the team but not sure what their view will be on this.

Please be patient.

reetp avatar Dec 09 '24 11:12 reetp

Can you please open a Pull Request with the fix you are proposing? Please, make sure to check our guideline here

scuciatto avatar Dec 10 '24 19:12 scuciatto

Fixed with slight logic improvement

Make a proper PR as requested please

reetp avatar Dec 11 '24 09:12 reetp

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.

Gustrb avatar Jan 06 '25 16:01 Gustrb

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)

DustpaN-Spb avatar Jan 09 '25 07:01 DustpaN-Spb

Under the field we have tooltip: (Multiple lines can be used to specify multiple gateways)

Can you post a screenshot please?

reetp avatar Jan 09 '25 08:01 reetp

push_gateways

DustpaN-Spb avatar Jan 09 '25 09:01 DustpaN-Spb

Please reopen

DustpaN-Spb avatar Jan 27 '25 08:01 DustpaN-Spb

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.

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.

reetp avatar Jan 27 '25 11:01 reetp

I'll ask Gustavo to check again

casalsgh avatar Jan 27 '25 11:01 casalsgh

Fair, I'll test this when I get back. But Idk why it would make sense to support more than one gateway

Gustrb avatar Jan 27 '25 12:01 Gustrb