8

Need help
I run a website which runs on PHP(so does devRant) and we want to implement web push notification, now i'm unable to understand how this will work?
1) notification is supposed to be sent from backend? how to know where to send
2) notification is supposed to be sent from javascript? how would i customise it, secondly how to send when user is not on our website
3) is there any tutorials which shows the working example rather than just showing javascript part?
thank you

Comments
  • 0
    subscribing
  • 2
    The whole thing works though sockets. You create events that the client listens to and acts upon.

    You can do this yourself or though 3rd party services but they can be pricey.
  • 1
    @dfox any help?
  • 2
    @randombug push notifications in general are tricky. I think @nblackburn's idea of a third party service is a good one for many cases because of the ease of implementation.

    We use a basic PHP implementation (just search PHP apn for iOS), but you also need something to make it async since generally you don't want to hold up the request while you send the notification. We use SQS for all of our queuing.
  • 1
    I'm not aware of a web exclusive offline push notification technique (but would be happy to learn of one). If offline is avoidable then web sockets are the way to go, not sure about php but im sure there will be libraries to make life easier.
  • 1
    Pop your PHP code into a Laravel installation and check Laravel Echo for easy event broadcasting. That should do the trick. (Laracasts has a nice video series about this)
  • 0
    @anth12 I think Server Sent Events are better for this particular use case , websocket's two way link might be an overkill.
  • 1
    Use SNS from AWS
  • 1
    Firebase is good too....
  • 0
    I used to develop this stuff. It's service workers doing it mostly, try googling 'progressive web apps' for more info.
    Short answer to your question is yeah you can build something yourself following one of many tutorials available online. But, once your requirements start getting a bit advanced such as segmentation, personalization, and attribution, you might want to start looking at a vendor who does this stuff for a living.
  • 0
    With the development of Internet resources, there is a need to quickly deliver information to users without waiting for them to make a request, right?
Add Comment