How To Send Push Notifications With JavaScript?

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ก.ย. 2022
  • Hey everyone, I am Piyush Garg and in this video, we are going to learn how we can send push notifications to a user via browser using React and Firebase cloud messaging.
    ► Complete Code Link: drive.google.com/drive/folder...
    Quick Links
    ► Firebase Console: firebase.google.com
    ► Firebase Docs: firebase.google.com/docs
    ► Firebase Cloud Messing Docs: firebase.google.com/docs/clou...
    Featured Playlists
    ► Complete Java Tutorial Series - • Java Tutorial Series i...
    ► Complete ReactJS Tutorial Series - • Complete React Tutoria...
    ► Complete Firebase & React Tutorial Series - • Firebase with Reactjs ...
    ► Website - piyushgarg.dev
    Social Links
    ► Instagram - / piyushgarg_dev
    ► Facebook - / piyushgarg.dev
    ► LinkedIn - / piyushgarg195
    ► Telegram Channel Link t.me/codewithpiyushgarg
    Video Titles
    How to send push notifications using javascript?
    How to send push notifications using React?
    How to send notifications in chrome?
    How to use firebase cloud messaging in react?
    How to use firebase cloud messaging?
    Tags
    - React
    - Firebase
    - Firebase Cloud Messaging
    Hashtags
    #reactjs #reactjsdeveloper #firebase #firebasecloud #javascript #serviceworker

ความคิดเห็น • 86

  • @rahulagrawal10
    @rahulagrawal10 2 หลายเดือนก่อน +1

    Hey Piyush, I used to be addictive to your videos now and for mostly all the topics on which I want to learn something, I search for your video. Thank you so much for your great efforts.

  • @office-jayukani
    @office-jayukani ปีที่แล้ว +4

    Thanks for the video 👍,
    It is working fine in my react app

  • @zaynsaifi5331
    @zaynsaifi5331 ปีที่แล้ว +1

    Tnx bro,i was looking for this from past 2 monthes,but didnt find exact expected result,really really tnx brother

  • @MuhammadAyaz-gp7xd
    @MuhammadAyaz-gp7xd 10 หลายเดือนก่อน +1

    Love you brother. Keep the good work up.

  • @user-dr7rw2kl4u
    @user-dr7rw2kl4u 9 หลายเดือนก่อน

    Thanks for this amazing video, I checked many videos for push notification but that one is not working but your video is very impressive, your description is very good

  • @user-rh9sl1ww9k
    @user-rh9sl1ww9k ปีที่แล้ว +2

    very helpful video . appreciated...

  • @abdullaharz5945
    @abdullaharz5945 7 หลายเดือนก่อน

    Such a helpful Video Thanks

  • @techknowledgebase4504
    @techknowledgebase4504 11 หลายเดือนก่อน

    HI, v10.2.0 with sw Nextjs not working windows 10 but same setup working in MacOS. Are you know how to solve that?

  • @mausoofnawazish134
    @mausoofnawazish134 ปีที่แล้ว

    thanks bro, But what you actually did on the chrome permission settings? from that it's not comming like a notification.

  • @shitalchavan5538
    @shitalchavan5538 ปีที่แล้ว +1

    Can anyone tell me how to read notification sent in the browser. What is the use of onMessage method in firebase

  • @sunnyy6295
    @sunnyy6295 8 หลายเดือนก่อน +1

    can i use this in electronjs project as well?

  • @ajayjb8727
    @ajayjb8727 ปีที่แล้ว +3

    Thank you, awesome video, I was having trouble with creating firebase-messaging-sw.js file in public folder, finally solved it.

    • @piyushgargdev
      @piyushgargdev  ปีที่แล้ว +1

      Nice work!

    • @ajayjb8727
      @ajayjb8727 ปีที่แล้ว

      @@piyushgargdev In Firebase docs they have mentioned you can add meaningful content. Even after Googling also can't able to find right solution. I still don't understand why firebase has made it so complicated.

  • @sagarghosh123
    @sagarghosh123 11 หลายเดือนก่อน +1

    It's not possible using wordpress website we can connect with Firebase for push notification. Please assist.

  • @shubhanshusahu7406
    @shubhanshusahu7406 ปีที่แล้ว

    underrated video

  • @rajeshchitikela5847
    @rajeshchitikela5847 ปีที่แล้ว +1

    In Android I am just getting notification and it is sitting in the notification tray, how would I be able to make it as a floating notification?

  • @ritankarbhattacharjee7661
    @ritankarbhattacharjee7661 ปีที่แล้ว

    The video is absolutely great Piyush. But I don't what is the cause when I placed the service worker in public folder it did not work but when I moved it in src folder it started working also changed the import codes a bit

  • @user-ul6qv3qw1d
    @user-ul6qv3qw1d ปีที่แล้ว

    best tutorial

  • @jairoandresguevarajulio571
    @jairoandresguevarajulio571 ปีที่แล้ว

    Thanks for the video, great job

  • @DEVILGAMING-tj1ee
    @DEVILGAMING-tj1ee 5 หลายเดือนก่อน

    Dom elements are not accessible in this file can you help me out with this? Sir!

  • @AnibalGutierrezYoSoy
    @AnibalGutierrezYoSoy ปีที่แล้ว

    Hola! se puede enviar la notificacion directamente desde la app en modo admin?

  • @manojpoojary
    @manojpoojary 5 หลายเดือนก่อน

    Thank you sir

  • @mohammedtaha3217
    @mohammedtaha3217 ปีที่แล้ว

    Lovely Video

  • @timetopass23
    @timetopass23 2 หลายเดือนก่อน

    How can i set Foreground notifications?
    Means website open in active tab i need that time also notifications

  • @AmmadAhmed-ou9bp
    @AmmadAhmed-ou9bp 3 หลายเดือนก่อน

    Helpful! I recommend you guys to follow his tutorial if you doing this task,

  • @CHIRAGARORA-gj4cr
    @CHIRAGARORA-gj4cr 11 หลายเดือนก่อน +1

    very nice video

  • @intelligentperson2447
    @intelligentperson2447 6 หลายเดือนก่อน

    will this notification work even after the tab is closed?
    In background

  • @pushpajitbiswas3752
    @pushpajitbiswas3752 ปีที่แล้ว

    I'm not getting any notification, can you please help me. I did everything that showed in the video

  • @buntyswain
    @buntyswain 7 หลายเดือนก่อน

    Push notification comes but it is showing localhost:3000,how to change this?

  • @princerajput6709
    @princerajput6709 7 หลายเดือนก่อน

    hey piyush i am getting same notification twice can u please help me?

  • @pratikgosavi7341
    @pratikgosavi7341 28 วันที่ผ่านมา

    does it work on ios also?

  • @roshankumar-um9he
    @roshankumar-um9he ปีที่แล้ว

    how to give permission when we send data?
    i didn't get notification

  • @roshankumar-um9he
    @roshankumar-um9he ปีที่แล้ว

    facing issue in version 9.15.0 bro

  • @vivekknShots
    @vivekknShots ปีที่แล้ว

    provider.ts:122 Uncaught FirebaseError: Messaging: Missing App configuration value: "projectId" (messaging/missing-app-config-values). i ma getting this error i have already added the project id in the firebaseConfig still getting that error

    • @piyushgargdev
      @piyushgargdev  ปีที่แล้ว

      Can you paste your firebase config

  • @sagargunjal1590
    @sagargunjal1590 ปีที่แล้ว

    I got two notifications instead of one after sending it from fcm

  • @gracemathew61
    @gracemathew61 10 หลายเดือนก่อน

    Benjamin thanks man i was so done with this you saved me , praise the lord maybe break some laws

  • @sonalarya5541
    @sonalarya5541 ปีที่แล้ว

    Hello, I receiving the error importScript not found why this happening I did everything correctly..?

    • @piyushgargdev
      @piyushgargdev  ปีที่แล้ว

      Don't worry, the code would still work fine. That's just an error from your IDE, not the actual error in your code.

  • @simba6510
    @simba6510 ปีที่แล้ว

    thanks bro, this video helped me so much.

  • @umershabir7045
    @umershabir7045 ปีที่แล้ว +1

    amazing! video, but as per the test message it's working but when I sent notification it didn't showed up

  • @krcpr007
    @krcpr007 ปีที่แล้ว

    what if a user is using your application with multiple device then how token will work ?

    • @piyushgargdev
      @piyushgargdev  ปีที่แล้ว +1

      You need to store all the tokens as an array in your database. Each token is unique to device.

  • @Codebyakshay
    @Codebyakshay 7 วันที่ผ่านมา

    ia ma getting this error care to explaing ?
    ERROR
    Registration failed - push service error
    ERROR
    Registration failed - push service error

  • @Chawan-dog-kennal
    @Chawan-dog-kennal หลายเดือนก่อน

    Bhai simple JavaScript app or PWA app may kashe kre

  • @Anythiny
    @Anythiny 8 หลายเดือนก่อน

    add one more video to this playlist on firebase hosting

  • @saqibhussain2843
    @saqibhussain2843 ปีที่แล้ว

    great.
    but how can we send push notification programmatically I mean when a user click a button(reactjs,html etc) it should triggered a notification

    • @riiadada5283
      @riiadada5283 ปีที่แล้ว +2

      "web dev simplified" did a turorial on what you want to acheive .(on youtube)

    • @zinx6809
      @zinx6809 ปีที่แล้ว

      ​@@riiadada5283 thanks

  • @shivamkumartripathi3052
    @shivamkumartripathi3052 ปีที่แล้ว

    How to send notification in safari browser because it is not working in safari

  • @f4kshort633
    @f4kshort633 ปีที่แล้ว +2

    Bhai mobile main notification send nahi kar raha hai please help

  • @axioluxe
    @axioluxe ปีที่แล้ว

    i have followed but not work

  • @SanjayNG125
    @SanjayNG125 7 หลายเดือนก่อน

    How to hide our firebase details...??

  • @pulkitjain5159
    @pulkitjain5159 10 หลายเดือนก่อน

    doing every thing right still it's not working at all

  • @mawaisnabeel
    @mawaisnabeel ปีที่แล้ว

    ya jo code end pa video skip kr k add kia ha kahan sy kia ha

  • @imtiyaz9331
    @imtiyaz9331 9 หลายเดือนก่อน

    Sir How to send push notification to multiple devices

  • @geovajonnathacorreia559
    @geovajonnathacorreia559 ปีที่แล้ว

    why do you need initialize firebase in two files ?

  • @Rohut500
    @Rohut500 9 หลายเดือนก่อน

    Website mein kaise lagaye

  • @weekendplayer442
    @weekendplayer442 8 หลายเดือนก่อน

    export const app = initializeApp(firebaseConfig);
    export const messaging = getMessaging(app);
    Server Error
    ReferenceError: navigator is not definedI

  • @sayantabhattacharjee9808
    @sayantabhattacharjee9808 ปีที่แล้ว

    8:56 localhost:3000 wants to know your location🤣🤣

  • @actiongamerz1643
    @actiongamerz1643 ปีที่แล้ว

    sir aapki jo 11:50 per error aati hai wo meri bhi same aa rahi hai but aapki solve hoo gai meri nahi ho rahi hai, Please Help.

    • @piyushgargdev
      @piyushgargdev  ปีที่แล้ว +1

      Have you made firebase-message-sw file?

    • @flutterdart4542
      @flutterdart4542 ปีที่แล้ว

      did you got any solution?

  • @user-pt3oi4wp7w
    @user-pt3oi4wp7w 6 หลายเดือนก่อน

    Not receiving notifications

  • @zanhbenz
    @zanhbenz ปีที่แล้ว +2

    unhandledRejection: FirebaseError: Messaging: This browser doesn't support the API's required to use the Firebase SDK

  • @user-hx1sg7ey6x
    @user-hx1sg7ey6x ปีที่แล้ว

    hi, how to fix duplicate notifications?

    • @trapz3666
      @trapz3666 ปีที่แล้ว

      hey did you find the solution?

    • @ThanHtutZaw3
      @ThanHtutZaw3 11 หลายเดือนก่อน

      Just temporally remove code self.registration.showNotification in service worker . It sends duplicate because we are sending from our app and also from the firebase console .

  • @enongenegilian9367
    @enongenegilian9367 ปีที่แล้ว

    why do you speak in your dialet?

    • @piyushgargdev
      @piyushgargdev  ปีที่แล้ว

      Hi There, I feel more comfortable in speaking in Hindi, so thats why :)

  • @jaif2900
    @jaif2900 ปีที่แล้ว

    Wrong video doesn't works

  • @muneeburrehman7761
    @muneeburrehman7761 2 หลายเดือนก่อน

    Very disappointing video, I came here to see how you have implemented this for the foreground notifications but you didn't show that

  • @gouthamasatheesh
    @gouthamasatheesh ปีที่แล้ว

    I followed the same thing in Next JS. But I got some errors.
    utils/firebase.js (18:38) @ eval
    TypeError: (0 , firebase_messaging__WEBPACK_IMPORTED_MODULE_1__.getMessaging) is not a function
    FirebaseError: Firebase: Firebase App named '[DEFAULT]' already exists (app/duplicate-app).
    These are the errors, I have got. Can you please help me to resolve this?

    • @piyushgargdev
      @piyushgargdev  ปีที่แล้ว

      It seems like you are trying to create a file with name that is conflicting with some package. Can you share your code please?

    • @optymystyc
      @optymystyc ปีที่แล้ว

      You have to use the getApps package to see if there are any existing apps instantiated.

  • @victorferreira2742
    @victorferreira2742 10 หลายเดือนก่อน

    does it work for iOS?