Skip to content

Commit

Permalink
Upgrade push notifications to Firebase HTTP v1 API
Browse files Browse the repository at this point in the history
  • Loading branch information
sarithapillai8 committed Jan 4, 2024
1 parent e0137e1 commit 4d4ea73
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ async function APNSpush(certificate, device, payload) {

// Send a Firebase (Google) push notification using `certificate` to the specified `device`.
async function GCMpush(certificate, device, payload) {
const client = http2.connect("https://fcm.googleapis.com:443")
const buffer = Buffer.from(JSON.stringify({
...payload, "to": device
}))
const client = http2.connect("https://fcm.googleapis.com:443/v1/projects/api-6882780734960683553-445906")
const buffer = Buffer.from(JSON.stringify({message:{
...payload, "token": device
}}))
const request = client.request({
[':method']: 'POST',
[':path']: `/fcm/send`,
[':path']: `/messages:send`,
"Content-Type": "application/json",
"Content-Length": buffer.length,
"Authorization": `Bearer ${certificate}`,
Expand Down

0 comments on commit 4d4ea73

Please sign in to comment.