Skip to content
Snippets Groups Projects
Commit b82e0b64 authored by Daniel's avatar Daniel
Browse files

app/service: Impl. cloud and relay service

parent bf0ab829
Branches
No related merge requests found
/*
* Tugas Besar 3 WBD - AMEN
*/
'use strict'
const messaging = require('firebase-admin').messaging()
let db = {}
module.exports = {
register (id, token) {
db[id] = token
},
unregister (id) {
delete db[id]
},
async sendAsync (id, message) {
await messaging.sendToDevice(db[id], message)
}
}
/*
* Tugas Besar 3 WBD - AMEN
*/
'use strict'
const cloud = require('./cloud')
let db = {}
module.exports = {
associate (id, driverId) {
db[driverId] = id
db[id] = driverId
},
disassociate (id) {
let pairId = db[id]
delete db[id]
delete db[pairId]
},
async sendAsync (id, message) {
await cloud.send(db[id], message)
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment