From 947dd507870976ad5fb29d76da7689cf88170cb0 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Tue, 14 Jul 2020 11:22:43 +0200 Subject: server: Update firebase admin SDK, and add non-data notification content --- firebase-io/firebase-io.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'firebase-io/firebase-io.js') 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, -- cgit v1.2.3-54-g00ecf