Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 188.8.131.52 release ready!
Owner and Founder. Opencart
Firebase Cloud Functions are still in their Beta phase but I still think its the best Feature of Firebase, making any things easier for developers. In one of my previous blog, I presented a method to send notification message to a Firebase Notification key if there is a new message for that user. Now I am here to provide you a way to send messages to multiple notification keys or tokens whenever there is a new message for that person or group, whatever the case is for you.
For that firstly lets see our database structure first. So this is the database structure. There are two main sub-sections namely data and messages. The data part contains customer data while the message part contains the messages exchanged between people.As we can not enter single token values under tokens filed because its a json-based database, I used the one defined in Firebase sample i.e. to use token value as key and giving value true against the json value. You can provide any other value if you want.
So now lets move on to writing the event function. So all the process is same just we need a iterator to iterate through all the values in tokens so we are using method Promise.all() The final method I got is as
And here you got to send message to multiple tokens whenever a new message is added to the particular sender node.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.