In this tutorial, you are going to learn how to communicate with the users of your application by integrating push notifications and subscriptions ...
For further actions, you may consider blocking this person and/or reporting abuse
[Worker Messenger] [Page -> SW] Could not get ServiceWorkerRegistration to postMessage!
Am facing this error any idea why?
I'm getting this intermittently too.
@sean Thompson
This issue occurs when you are not subscribed to onesignal, i figured this out yesterday while working @pato you can make a note of this, if some one reported to you regarding this ask them whether they have subscribed or not
Awesome! Thanks so much
Hey Pato, I am still facing this issue can you give some suggestion that can help me. (User has subscribed already)
Thank you
check your configuration mostly that should be the problem
Did you get it fixed Kannan? Is there something I need to fix from the article?
No pato, your article is fine and it helped me allot, thank you for the article
Thanks for the article, but how do i test this out in local environment? Is there any way we can do it, because everytime i do some changes i can't push it to production and test it
And also am facing an issue here, i will post that tomorrow morning as its late night here, your article helped me to start up with one signal thank you
Hi I need to update the docs but essentially you will do this as the image shown, that way you dont have to keep redeploying our app all the time
dev-to-uploads.s3.amazonaws.com/up...
Hi i can't see local testing button from my side attaching screenshot as reference
dev-to-uploads.s3.amazonaws.com/up...
You have to enter a localhost url that way the form will detect it and give you the options you need
Thanks it worked with localhost now, now ill show the issue am facing
dev-to-uploads.s3.amazonaws.com/up...
Did you download and add the sdk files into your project?
5) Inside of the React project, the first thing you are going to do is to add the services worker files you downloaded into your PUBLIC folder.
You should be adding 2 files:
OneSignalSDKUpdaterWorker.js
OneSignalSDKWorker.js
You can download the files here too github.com/OneSignal/OneSignal-Web...
Thank you for sharing this. I wonder how can I listen to OneSignal Event with ReactJS (and do something else with that data) after I received the notification.
Hi Sathittham! I want to make sure I'm understanding the question.
1) I send a push notification from the OneSignal portal
2) I received a push notification that has the title and body Ex.
React JS tutorial
Take a look to my new ReactJS tutorial!!
and then in your ReactJS app grab the title of the push notification?
Yes, I want to grab data (id, heading, content, data, url, icon) from the notification.
Hi @sathittham, I am looking for the same thing. If you have done it, please share the event that was triggered to achieve this.
Hey, thanks for this article. it was really helpful but ran into a problem.
How can we use this with a PWA having it's own service worker?
You can, you will have to change the scope of the service worker of OneSignal.-
something like this:
I'm back again Pato, been on this for weeks.
At the moment, i'm getting "the script resource is behind a redirect which is disallowed" and have tried
Please help.
Hi Pato, thank you for this it is working really well but I don't understand this part. In mine the scope is set to /push/onesignal/... what is this doing?
Can you show me a screenshot of where you are seeing that, please? Thank you so much!
Hi, I have a problem, maybe my implementation is wrong, but I want your feedback, I've tried to implement onesignal on my reactjs web app (it's not react native).
I tried 3 differents aproachs:
1.- Following the oficial onesignal web push sdk documentation.
2.- This aproach.
3.- Using this package github.com/pedro-lb/react-onesigna...
All of them I've completed successfully, but all have a strange behavior on my reactjs web app.
When my app get the notifications permissions for first time and I accept it, it doesn't show the welcome notification and if I send a notification from my onesignal dashboard it doesn't show.
If I refresh (F5) my app two times and send another notification, it works and show correctly. But if for any reason I refresh again my app, the notifications don't work anymore and in my onesignal dashboard shows that my player id is unsubscribe.
Somebody has the same issue? or what could be wrong in my app? Thanks.
Hi Elias! Interesting problem. I haven't run into that issue. If you can create a minimal replication of you project and paste the link to your repo here I can try it on my computer.
what browser are you using?
window.OneSignal = window.OneSignal || [];
Showing error in app.tsx
I used this code from: stackoverflow.com/questions/564579...
declare global {
interface Window {
OneSignal: any;
}
}