有人了解Firebase Cloud Messaging是否支持VOIPpushkit服务吗?
如果是的话,能否请提供相关指南。
与Skype / Hangout / WhatsApp或其他基于VOIP的应用程序实现的相同。
先感谢您的协助。
有人了解Firebase Cloud Messaging是否支持VOIPpushkit服务吗?
如果是的话,能否请提供相关指南。
与Skype / Hangout / WhatsApp或其他基于VOIP的应用程序实现的相同。
先感谢您的协助。
这对我很有帮助!别忘了在您的目录中添加Authkey_xxxx.p8文件,并且不要忘记将.voip添加到通知主题的捆绑标识符中。
export const test = functions.https.onRequest((request, response) => {
const config = {
production: false, /* change this when in production */
token: {
key: "./AuthKey_xxxx.p8",
keyId: "xxxx",
teamId: "yyyy"
}
};
const apnProvider = new apn.Provider(config);
const notification = new apn.Notification();
const recepients: string[] = [];
recepients.push(apn.token('SOME PUSHKIT TOKEN'));
recepients.push(apn.token('ANOTHER PUSHKIT TOKEN'));
notification.topic = 'com.your.app.voip'; // you have to add the .voip here!!
notification.payload = {
// some payload
};
return apnProvider.send(notification, recepients).then((reponse) => {
console.log(reponse);
return response.send("finished!");
});
});
export const test = functions.https.onRequest((request, response) => {
const config = {
production: false, /* change this when in production */
cert: 'yourCERT.pem',
key: 'yourKey.pem',
};
const apnProvider = new apn.Provider(config);
const notification = new apn.Notification();
const recepients: string[] = [];
recepients.push(apn.token('SOME PUSHKIT TOKEN'));
recepients.push(apn.token('ANOTHER PUSHKIT TOKEN'));
notification.topic = 'com.your.app.voip'; // you have to add the .voip here!!
notification.payload = {
// some payload
};
return apnProvider.send(notification, recepients).then((reponse) => {
console.log(reponse);
return response.send("finished!");
});
});
node-apn
。 - Anubhab Maji2022年写作
目前不可能。
理论上,根据苹果apns请求规范,似乎我们只需要在头文件中指定以下内容:
apns-push-type: "voip",
apns-topic: "<app-bundle-id>.voip"
{
"message": {
"token": "fcm-token",
"apns": {
"headers": {
"apns-push-type": "voip",
"apns-topic": "<app-bundle-id>.voip"
},
"payload": {
"aps": {
"contentAvailable": 1
},
"customKey": "customValue"
}
}
}
}
message.apns.payload
对象与headers
一同发送到APNs服务器。