Push Notification with Ruby On Rails - Setting up the project

in #utopian-io6 years ago (edited)

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.

Reference from my own blog

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

Sort:  

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

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

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

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.033
BTC 63071.06
ETH 3121.31
USDT 1.00
SBD 3.84