diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2020-07-14 11:22:43 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2020-07-14 11:22:43 +0200 |
commit | 947dd507870976ad5fb29d76da7689cf88170cb0 (patch) | |
tree | 9ce9f9957bfc4ba149ff107e96cad9c32e2fbd14 /firebase-io/firebase-io.js | |
parent | ac99b8ffc7f56889fdd8e15d73be0581a66d71f2 (diff) |
server: Update firebase admin SDK, and add non-data notification content
Diffstat (limited to 'firebase-io/firebase-io.js')
-rwxr-xr-x | firebase-io/firebase-io.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/firebase-io/firebase-io.js b/firebase-io/firebase-io.js index cc5eaca..9c96224 100755 --- a/firebase-io/firebase-io.js +++ b/firebase-io/firebase-io.js @@ -2,6 +2,12 @@ const firebase=require("firebase-admin"); const util=require("util"); +// Potential TODO's: +// - Use collapseKey to collect notifications for particular rooms +// - But note that you cannot have more than 4 collapseKeys at a time; +// correctly managing this requires synchronisation between app and server +// of exactly what keys have disappeared in the meantime + firebase.initializeApp({ credential:firebase.credential.cert(require("./firebaseServiceAccountKey.json")), databaseURL:"https://tomsg-83196.firebaseio.com", @@ -77,6 +83,10 @@ function processMessage(type,fields){ const message=fields.get("message"); const token=fields.get("token"); const payload={ + notification: { + title: room + " (" + user + ")", + body: message, + }, data: { user: user, room: room, |