Skip to content

Commit

Permalink
fix: switch to #send method of fcm (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramank775 authored Sep 30, 2024
1 parent 4882a8c commit 653fc2b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
19 changes: 11 additions & 8 deletions services/notification-ms/pns/firebase-pn-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}

/**
Expand Down

0 comments on commit 653fc2b

Please sign in to comment.