Closed Bug 1212912 Opened 4 years ago Closed 3 years ago

Best Practices MDN document for Push Notifications in Firefox

Categories

(Core :: DOM: Push Notifications, defect)

44 Branch
defect
Not set

Tracking

()

RESOLVED FIXED
Tracking Status
firefox44 --- affected

People

(Reporter: wmaggs, Unassigned)

References

Details

There have been several requests from developers planning or already using Push Notifications in their websites for a detailed best practices document that is specific to Firefox. We are mostly following the spec, but as with any implementation there are some differences. This could be an update or link to the general MDN document 

https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Using_the_Push_API

but probably should be a Firefox-specific document. 

Since Push is new and not broadly in use, many of these best practices will evolve over the next several Firefox releases. Some of the best practices will be related to how the developer  interacts with our Push infrastructure as touched on in 

https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription
(In reply to Bill Maggs (bmaggs) from comment #0)
> There have been several requests from developers planning or already using
> Push Notifications in their websites for a detailed best practices document
> that is specific to Firefox. We are mostly following the spec, but as with
> any implementation there are some differences. This could be an update or
> link to the general MDN document 
> 
> https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Using_the_Push_API
> 
> but probably should be a Firefox-specific document. 
> 
> Since Push is new and not broadly in use, many of these best practices will
> evolve over the next several Firefox releases. Some of the best practices
> will be related to how the developer  interacts with our Push infrastructure
> as touched on in 
> 
> https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription

I agree that we need to cover any Firefox-specifics, but I'm not really happy about having a separate document for it. This could create repetition with the main tutorial and confusion (e.g. is this a Mozilla-specific Push implementation? We already have Simple push to create confusion.)

Since we are trying to follow a standard here, how many differences are there going to be to document? If we really need to, we can surely cover any differences in the same way as we currently do for Chrome:

https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Using_the_Push_API#Extra_steps_for_Chrome_support

?
I'm totally fine with an extension of the above document with a section for best practices on Firefox. The standard is mostly being implemented, with some differences, but we had significant dev feedback that best practices on our browser need to be captured somehow.
(In reply to Bill Maggs (bmaggs) from comment #2)
> I'm totally fine with an extension of the above document with a section for
> best practices on Firefox. The standard is mostly being implemented, with
> some differences, but we had significant dev feedback that best practices on
> our browser need to be captured somehow.

Cool - I'm happy to implement this in the existing doc. I should be able to get going with this next week.

Martin, are you a good man to talk to about the Firefox platform differences for Push? ;-)
Flags: needinfo?(martin.thomson)
You can talk to me about those things, yes.  I'm not sure what you are looking for from me, so perhaps you can let me know where the gaps are.
Flags: needinfo?(martin.thomson)
:marco and I can also help.
Because of partner meetings coming up, it would be great to get this update going as soon as possible :)
Flags: needinfo?(martin.thomson)
Flags: needinfo?(cmills)
See comment 4.  Still applies.
Flags: needinfo?(martin.thomson)
(In reply to Bill Maggs (bmaggs) from comment #6)
> Because of partner meetings coming up, it would be great to get this update
> going as soon as possible :)

This page contains all you need to know about Push in Fx or Chrome, to my current knowledge**:

https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Using_the_Push_API

** ok, so I still need to cover the pushsubscriptionchange event, but I'm adding a section on this today.

Is there anything else you need, Bill?
Flags: needinfo?(cmills)
Flags: needinfo?(wmaggs)
Seems like we covered the technical aspects.

It is missing the UX aspects of requesting push permission and sending notifications though. Google has these 2 documents:

Best Practices for Push Notifications Permissions UX: https://docs.google.com/document/d/1WNPIS_2F0eyDm5SS2E6LZ_75tk6XtBSnR1xNjWJ_DPE/edit?usp=sharing
Push Notifications Edge Cases and Mitigations: https://docs.google.com/document/d/1KbmuByY7mJsTtqS-Mh6cDBt463hmDdp-67rTcN-Gmn8/edit?usp=sharing

We also have partners that are experienced with push who would want to contribute. Mano is managing that aspect.
Flags: needinfo?(mbalasubramaniam)
(In reply to Harald Kirschner :digitarald from comment #9)
> Seems like we covered the technical aspects.
> 
> It is missing the UX aspects of requesting push permission and sending
> notifications though. Google has these 2 documents:
> 
> Best Practices for Push Notifications Permissions UX:
> https://docs.google.com/document/d/
> 1WNPIS_2F0eyDm5SS2E6LZ_75tk6XtBSnR1xNjWJ_DPE/edit?usp=sharing
> Push Notifications Edge Cases and Mitigations:
> https://docs.google.com/document/d/1KbmuByY7mJsTtqS-Mh6cDBt463hmDdp-67rTcN-
> Gmn8/edit?usp=sharing
> 
> We also have partners that are experienced with push who would want to
> contribute. Mano is managing that aspect.

I've linked to these at the bottom of our document, in the "See also" section.
We need to capture the quota best practices: https://bugzilla.mozilla.org/show_bug.cgi?id=1219850#c4

Kit, what would engineers be looking for?
Flags: needinfo?(kcambridge)
Kit wants us to be clear in the MDN doc about what Push is doing and not doing. The new quota experience is basically about only limiting the number of messages that don't show up on screen that can be delivered in a short period of time. I think that changing a single sentence in the MDN doc would accomplish this, but I leave it up to Chris Mills to decide and Kit to comment. 

Original paragraph: 

Activating a service worker to deliver a push message can result in increased resource usage, particularly of the battery. Different browsers have different schemes for handling this — there is currently no standard mechanism. Firefox allows a limited number of push messages to be sent to an application.  This limit is refreshed each time that the site is visited. In comparison, Chrome applies no limit but requires that applications show a notification each time that a push message is received, which allows the user to confirm that they still want to receive notifications and ensures user visibility.

New paragraph: 

Activating a service worker to deliver a push message can result in increased resource usage, particularly of the battery. Different browsers have different schemes for handling this — there is currently no standard mechanism. Firefox allows a limited number of push messages to be sent to an application, preventing too many messages that don't appear on the screen from being sent in a short period of time. This limit is refreshed each time that the site is visited. In comparison, Chrome applies no limit but requires that applications show a notification each time that a push message is received, which allows the user to confirm that they still want to receive notifications and ensures user visibility.
Flags: needinfo?(wmaggs)
Copy edit:

Activating a service worker to deliver a push message can result in increased resource usage, particularly of the battery. Different browsers have different schemes for handling this — there is currently no standard mechanism. Firefox allows a limited number of push messages to be sent to an application.  Push messages that generate notifications are exempt from this limit. The limit is refreshed each time the site is visited. In comparison, Chrome applies no limit but requires that every push message causes a notification to be displayed.
I like Martin's edit. "Push messages that generate notifications are exempt from this limit" is nice and pithy.
Flags: needinfo?(kcambridge)
I like Martin's wording too, so I've updated the relevant page with it (https://developer.mozilla.org/en-US/docs/Web/API/Push_API); I've made a small style edit.
Depends on: 1210211
Sounds like we've covered the bases.
Status: NEW → RESOLVED
Closed: 3 years ago
Flags: needinfo?(mbalasubramaniam)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.