-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
userVisibleOnly should be standardized to match browser behaviour #313
Comments
Yes, For example I have just received this message from a customer:
My first reply was that silent push is not allowed... but then I found this and I am really confused: Please clarify if that is really allowed and what exact actions are considered visible to the user. |
Note that the answer here will have a huge impact on the use of web push and on the load of push services: for example if you allow to send silent push when a website is open, someone could build an online chat based entirely on web push (without websockets). |
This would have a negative impact on our application as well. We use silent push notifications in many legitimate ways which improve the user experience. For example, as a way of clearing existing notifications that are no longer relevant, but have been sent to the device:
In addition, notifications can no longer be relevant if, for example, we ban a nuisance accounts on our site. We would want any notifications that user triggered to no longer be sent to those devices, or if they have, we want them to be cleared. A silent push notification is the only way to do this. As there is no way of revoking push notifications that have been sent. You have to implement this stuff in your own UX. You could technically implement a "revoke-like" notification by using a As another example - when users toggle on push notifications in the settings area of our app, we configure the PushManager, setup the subscription etc - and in the process we send a "silent" push notifications which we use to verify if the device is able to receive push notifications - if the notification came through, we then enable it on the server. It's basically just a sanity check and for peace of mind to make sure they are actually able to receive our push notifications. We could technically display a notification, but it never occurred to us doing this silently in the background is a "bad" thing to do. So in summary please don't blanket condemn silent push notification as some horrible nasty thing that apps do and inform users that something bad is happening. There are legitimate reasons why silent push notifications are beneficial to the end user. It would make a lot more sense if it was more about volume/quota of some kind - how much notifications are being sent/received. If it's beyond certain thresholds, then let the user know. |
the required I would also like to do some p2p webrtc signaling between 2 peers that are online without having to spin up a websocket connection. There is so much good stuff you can do with "silent" push but it is avoided b/c users have a tendency to block desktop notification and most often dismiss annpying prompt dialogs. i also totally agree with @garygreen about syncing notification across devices as some messages can be marked as read and then being totally irrelevant. ppl can disobey "must show a desktop notification" as they are free to simply just update the site if it's visible to the user so it dose not need to show a desktop notification when the user is active on the site... there is a useful feature to only allow sending silent push only when the user is active on the site cuz updates will only be happening on the site when users are online. and ppl don't wish to have to see that annying prompt dialog i do not think web push should be associated with desktop notification. Since silent push is a total other ball game. I'm more okey with I really think it should be fleshed up into two different things. desktop notification should not have to anything with web push:es. it should rather be a way for "desktop notification" to reset the amount of web push:es you are allowed to send when user isn't on the website itself that way i don't need any consistent open WebSocket to 1000 ppl each using a different port and only being idle for the most part when there isn't any data being sent (i only keep it open in case if i need to send something) the hole prompting dialog for sending out silent push (and only if the user is online) is only going for the most part be rejected as most ppl associate push notifications as something annoying on the web. I genially would consider allowing more web sites to actually using silent web pushes if i'm being active on the page and was prompted and aware as they are not as annoying as push that requires a visible notification. but i would rather wish that they didn't prompt anything at all and only functional while being active on the site. (seeing it as mostly a short session subscription) |
Liking a lot of what others are saying. To throw in my 2 cents succinctly: What was the intention with Right now, it seems like it might not be needed. NotificationAPI already handles the permissions, and I'm missing any meaningful security differences between PushManager and WebSockets. |
@SephReed There's a big difference between PushManager and WebSockets: one can only work when a website is open, while the other can be activated in background. That's why |
I for instance only want to use background push while the user have a tab open to my domain (to avoid having to create WebSockets) Chrome accepts silent push if the user is active on your domain. but it requires a darn prompt for desktop notification to allow it - which most ppl will block anyway so i can't really use it for anything good. I know when ppl leave the site, so i will not send a push notification then. |
Based on this information, iOS will revoke the push subscription if the application fails to show the notification. It requires use of self.addEventListener('push', (event) => {
event.waitUntil(self.registration.showNotification('title', {
...
}));
} |
@elf-pavlik All the information linked in your post seems really old (WWDC 2022), not something new. Are you posting it here because you have seen some new announcements or changes from Apple? |
I came across the post I linked and this issue while trying to find the details about the implications of |
@elf-pavlik You cannot use silent push, it was never allowed. I wrote about it years ago and nothing changed in the meantime. |
Never allowed in Safari/Chrome you mean? |
The current spec text does not actually require anything relating to user-visible actions, while browsers have all sorts of requirements around this concept. It currently only says this:
"indicates that ... will only be used for push messages" suggests that this member is a hint passed from the site to the UA indicating how it intends to behave. Not only doesn't it require any specific action on the UA, it doesn't even suggest that the UA should do anything.
My understanding (based on a private email with @beverloo ) is that some browsers (e.g., Chrome) require
userVisibleOnly
(effectively making it a de facto requirement that sites setuserVisibleOnly
), and that many browsers (whetheruserVisibleOnly
is set or not) impose some sort of penalty for sites that do not show a notification when receiving a push (the penalty could be showing a UA-generated notification or unsubscribing from push).Contrary to that, it is reasonable for a developer reading this spec text to assume that both:
a) They can set
userVisibleOnly
tofalse
(the default) and then receive pushes without showing a notification, and thatb) If they do set
userVisibleOnly
to true, it won't actually do anything, so perhaps it's fine to set it totrue
with the intention of showing a notification, but conditionally deciding not to show a notification in certain situations.I understand the need to avoid mandating a particular UX in the spec, but I think the spec text could be worded a bit stronger and closer to reality.
How about:
userVisibleOnly
be set totrue
(and note that its existence is a historical artifact). Or even removinguserVisibleOnly
with the assumption that it's true.In more detail (assuming we won't delete
userVisibleOnly
for now):subscribe
method", there needs to be an explicit step which rejects the promise ifuserVisibleOnly
isfalse
.userVisibleEffect
is described.This way, the spec creates precise logic for detecting "non-user-visible pushes", and while it doesn't mandate a specific UX response, suggests that the UA take some punitive action in this case.
The text was updated successfully, but these errors were encountered: