From 653fc2b76c7a65f4f03d22d2b4cdee6cd3797e6e Mon Sep 17 00:00:00 2001 From: Raman <24293550+ramank775@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:59:45 +0530 Subject: [PATCH] fix: switch to #send method of fcm (#97) --- package.json | 2 +- .../pns/firebase-pn-service.js | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index f646a50..e4a1853 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chat-server", - "version": "2.8.2", + "version": "2.8.3", "description": "A chat server based on the microservice architecture to ensure high availability, high throughput, horizontal scalability.", "main": "", "repository": "https://github.com/ramank775/chat-server.git", diff --git a/services/notification-ms/pns/firebase-pn-service.js b/services/notification-ms/pns/firebase-pn-service.js index ef7f75f..37b96cb 100644 --- a/services/notification-ms/pns/firebase-pn-service.js +++ b/services/notification-ms/pns/firebase-pn-service.js @@ -28,18 +28,21 @@ class FirebasePushNotificationService extends IPushNotificationService { * @param {Object} payload */ async push(token, payload) { - const chatPayload = { - data: { - message: payload, - }, - }; const options = { priority: 'high', timeToLive: this.#ttl, }; - await this.#messaging.sendToDevice(token, chatPayload, options).then((response) => { - this.#logger.info('Push notification sent successfully', response); - }); + await this.#messaging + .send({ + token: token, + data: { + message: payload, + }, + android: options, + }) + .then((response) => { + this.#logger.info('Push notification sent successfully', response); + }); } /**