RocketChat / RocketChat/Rocket.Chat

Multiple Push notificatons gateways

Open
#34,034 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

planned
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in apps/meteor/app/push/server/push.ts at sendNotificationGateway and inspect how this.options.gateways is iterated. Reproduce the issue with multiple configured gateways and add coverage showing delivery reaches each gateway; done when one push is sent through every configured gateway rather than stopping at the first.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.