Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
ember-service-worker-emberfire-messaging
Advanced tools
Firebase Cloud Messaging service worker support for Emberfire apps.
A push notification Ember Service Worker plugin for Firebase Cloud Messaging using Emberfire.
ember install ember-service-worker-emberfire-messaging
Step 1: basic setup is done in the config/environment.js
file:
// Ensure Emberfire is correctly configured
var ENV = {
firebase: {
appId: 'abc',
apiKey: 'xyz',
authDomain: 'YOUR-FIREBASE-APP.firebaseapp.com',
databaseURL: 'https://YOUR-FIREBASE-APP.firebaseio.com',
storageBucket: 'YOUR-FIREBASE-APP.appspot.com',
projectId: 'my-firebase-app', // optional
messagingSenderId: "123456789012" // Required!
}
};
Message sender Id can be found in your firebase console > project settings > add app button > Add Firebase to your web app.
Step 2: gcm_sender_id
must be configured in your manifest.json file. For this purpose I recommend using Ember Web App where in your config/manifest.js
you should add the following:
module.exports = function() {
return {
// ...
// gcm_sender_id: '103953800507'
};
}
This Google Cloud Sender ID is not the same as your message sender ID. You can simply copy the value 103953800507
into your manifest.json!
Step 3: Use the Firebase Message Service to request the user's permission and subscribe to new message events.
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default Route.extend({
firebaseMessage: service(),
actions: {
requestUserPermission() {
/*
Before you can receive any messages you need to request the users'
permission to get push notifications
*/
this.get('firebaseMessage').initialize()
.then((token) => { // FCM registration token
// Homework: persist this token to your server!
});
}
},
init() {
this._super(...arguments);
/*
React to Firebase message when app is being viewed by user
*/
this.get('firebaseMessage').subscribe((message) => {
console.log('FCM JSON', message);
});
}
});
Customize this addon by adding any of the following to the config/environment.js
file:
var ENV = {
'esw-emberfire-messaging': {
firebaseVersion: '7.15.0', // default (Firebase version used by SW)
defaultBackgroundMessageTitle: 'New Message', // default (fallback title for background message)
notification: { vibrate: [200, 100, 200] } // optional global notification settings
}
};
Possible global notification options will be overwritten by any individual FCM notification options. Browser support of various notification options may vary.
To test your app's Firebase Messaging try the following in the terminal:
curl -X POST -H "Authorization: key=<YOUR_SERVER_KEY>" -H "Content-Type: application/json" -d '{
"data": {
"title": "Portugal vs. Denmark",
"body": "5 to 1",
"icon": "firebase-logo.png",
"click_action": "http://localhost:4200"
},
"to": "<DEVICE_REGISTRATION_TOKEN>"
}' "https://fcm.googleapis.com/fcm/send"
YOUR_SERVER_KEY
can be found in the firebase console under Project Settings > Cloud Messaging > Server key.
DEVICE_REGISTRATION_TOKEN
is the token you requested via this addon's firebase-message service.
Please refer to the Firebase docs for more information
git clone <repository-url>
this repositorycd ember-service-worker-emberfire-messaging
yarn
ember install ember-service-worker-emberfire-messaging
[Longer description of how to use the addon in apps.]
See the Contributing guide for details.
This project is licensed under the MIT License.
FAQs
Firebase Cloud Messaging service worker support for Emberfire apps.
The npm package ember-service-worker-emberfire-messaging receives a total of 6 weekly downloads. As such, ember-service-worker-emberfire-messaging popularity was classified as not popular.
We found that ember-service-worker-emberfire-messaging demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.