- Serverless Web Applications with React and Firebase
- Harmeet Singh Mayur Tanna
- 151字
- 2021-08-27 19:11:13
Cloud Messaging
Any Realtime app needs to send Realtime notifications. Firebase Cloud Messaging (FCM) provides a platform that helps you send the messages and notifications to the app user in Realtime. You can send hundreds of billions of messages per day for free across different platforms: Android, iOS, and web. We can also schedule the message delivery—immediately or in future. Notification messages are integrated with Firebase Analytics, so no coding is required to monitor user engagement.
Service Workers are supported on the following browsers:
- Chrome: 50+
- Firefox: 44+
- Opera Mobile: 37+
// Retrieve Firebase Messaging object.
const messaging = firebase.messaging();
messaging.requestPermission()
.then(function() {
console.log('Notification permission granted.');
// Retrieve the Instance ID token for use with FCM.
// ...
})
.catch(function(err) {
console.log('Unable to get permission to notify.', err);
});
The FCM SDK is supported only in HTTPS pages because of service workers, which are available only on HTTPS sites.
推薦閱讀
- JBoss Weld CDI for Java Platform
- Advanced Machine Learning with Python
- Node.js+Webpack開發實戰
- Visual FoxPro程序設計教程
- Mastering Articulate Storyline
- Mastering KnockoutJS
- Learning ELK Stack
- 精通Linux(第2版)
- 可解釋機器學習:模型、方法與實踐
- C語言程序設計上機指導與習題解答(第2版)
- Python深度學習原理、算法與案例
- 運維前線:一線運維專家的運維方法、技巧與實踐
- 超好玩的Scratch 3.5少兒編程
- Web開發的平民英雄:PHP+MySQL
- PHP動態網站開發實踐教程