pusher / push-notifications-web

Beams Browser notifications
MIT License
39 stars 19 forks source link

Silent push is displayed #71

Closed trevorrjohn closed 3 years ago

trevorrjohn commented 3 years ago

When sending a web push without a notification payload, I don't expect a notification to appear in my browser. However one does appear with an empty title and body.

{
  web: { notification: {}, data: { key: "value" } }
}
benw-pusher commented 3 years ago

Hi, I believe there are limitations (at least with Chrome) that prevent the use of the Push Notification framework being used for silent notifications. Google state:

You have to show a notification when you receive a push message.

Could you share a little more about your use case and what you're trying to achieve with these silent notifications? If you are looking for the ability to send realtime updates then you might consider using our Channels product which will allow you to add this functionality without presenting the unwanted notification to the user.

trevorrjohn commented 3 years ago

Thanks for the insight, I was hoping to use silent pushes to send a in-app modal that the app would display once the user opens the page. Unfortunately channels doesn't work for this as you have to be on the page to be subscribed to a channel (I believe?). Looks like we will have to come up with a more custom solution. Thanks again.