Skip to content

Commit

Permalink
Merge pull request #8 from BIDMCDigitalPsychiatry/issue-791
Browse files Browse the repository at this point in the history
Upgrade push notifications to Firebase HTTP v1 API
  • Loading branch information
sarithapillai8 authored Jan 4, 2024
2 parents e0137e1 + 4d4ea73 commit 24e29f3
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 24e29f3

Please sign in to comment.