Kat*_*tie 3 google-app-engine billing google-cloud-messaging firebase-realtime-database google-cloud-functions
我正在使用Google Cloud的免费试用版,而我几乎已经获得免费赠送的一半.我不知道我做错了什么,或者它的成本是否超出我的预期,所以我看着定价并意识到我不了解其中的大部分内容.我只是在学习和玩乐,所以我实际上并不想花钱(或者至少没有那么多),所以任何事情都可以帮助制作去年的免费学分:)
https://firebase.google.com/pricing/
我对我的功能所做的是从Firebase数据库获取有关通知的信息,然后使用Firebase Messaging发送通知.这是代码,如果有帮助的话.
'use strict';
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.sendNotifications = functions.database.ref('/Notifications/{pushID}/title')
.onWrite(event => {
if (!event.data.exists())
return;
event.data.ref.parent.once('value').then(function(dataSnapshot){
// Grab the eventName and the message
const title = dataSnapshot.child('title').val();
const message = dataSnapshot.child('message').val();
const recipients = dataSnapshot.child('recipients').val();
const tag = dataSnapshot.child('tag').val();
const payload = {
notification:{
title: title,
body: message,
tag: tag,
color: "#51E0F5",
sound: 'default'
},
};
const options = {
priority: 'high',
collapseKey: 'chat',
timeToLive: 3600 // 6 days
};
// Get rid of this Notification in Firebase
event.data.ref.parent.remove();
// Create notification
if (recipients != null)
{
return admin.messaging().sendToDevice(recipients, payload, options);
}
else
{
return;
}
});
})
Run Code Online (Sandbox Code Playgroud)
根据交易,我用过
如何停止使用App Engine Flex实例?它是什么?或者是时候在他们开始为我的卡充电之前寻找替代品了.
谢谢!
您可以通过停止VERSION来停止灵活的应用程序引擎中的所有实例.我一直用它来进行开发 - 没有意义保持一夜之间运行.
转到您的Google云平台控制台,选择应用引擎,然后选择版本.检查要停止的版本,然后单击顶部的停止.请注意,您实际上无法删除上一个版本,但可以将其停止:)这会关闭所有实例.
您无法停止 App Engine 灵活实例。您将始终有一个实例在运行。
请看一下下面的帖子
Google Appengine:预算和每日支出限制不起作用
这个问题也与 appengine 的计费和定价有关
问候
迈克尔
| 归档时间: |
|
| 查看次数: |
989 次 |
| 最近记录: |