aboutsummaryrefslogtreecommitdiff
path: root/firebase-io/firebase-io.js
diff options
context:
space:
mode:
Diffstat (limited to 'firebase-io/firebase-io.js')
-rwxr-xr-xfirebase-io/firebase-io.js10
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,