Push Notification with Ruby On Rails - Setting up the project
In my previous video, I gave an high level view of how push notification works. In this video tutorial, I will be explaining how you get started with ruby on rails, setting up project and install necessary gem.
Demo for you to try out
- Demo (P.S. You need to accept notification and press the "Click to Sub" Button)
- Send Push Message (Just fill in what you want to send)
Ruby Gem used
- serviceworker-rails (Use to setup service worker in Ruby On Rails Project)
- webpush (Setup Vapid and send Web Push protocol with this gem)
- json (JSON parsing in Ruby using this gem)
To get VAPID key
Install ruby gem webpush
gem install webpush
Then, in ruby console (irb
)
require("webpush")
vapid_key = Webpush.generate_key
puts vapid_key.public_key
puts vapid_key.private_key
You should never show your private key. I change my private key after this video.
A good practise is to store both key in .env
file.
Next Video
In the next video, I will explain setting up service worker with Ruby On Rails, setting up Push Event.
Posted on Utopian.io - Rewarding Open Source Contributors
Supine
Good one
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Please remove the image at the bottom. Calls for follow or upvote, resteem are not allowed in Utopian.
@espoem , I have updated. Sry for violating the rules.
Hey @superoo7 I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x