Firefox/Push Notifications

From MozillaWiki
Jump to: navigation, search

Overview

Push Notifications is a feature that enables web applications to efficiently notify users even when off-site. It's intended as a standards based feature utilizing Push API, Notifications API, WebPush Service.

Currently, email is the only reliable way for a web application to contact or notify users on desktop computers. Push Notifications introduces functionality for web applications to contact users when off-site ushering a new level of interactivity. There is a class of web sites where users don't often install mobile apps but do want a casual subscription to content. For example:

  • News: get notified from sfgate.com on stories around sports teams, restaurant reviews, current events.
  • Consumer: get notified when you've been outbid on ebay.com
  • Consumer: get notified when a specific item is posted on craigslist.org
  • Messaging: get notified when you get a message on IRCcloud, even when Firefox is closed.
  • Enterprise: While working on your laptop, get notified you have a sales lead on salesforce.com
  • Games: get notified that it's your turn in a Facebook scrabble game.

Status

Plan of Record - approved 9/18

Desktop: ON TRACK 2016/1/12

  • Fx44: Ship a quality, basic user-centered experience using Desktop Push Notifications.

Android:

  • Fx46: Land Push Notifications in Fx44 Nightly and evaluate user experience. (updated 10/15)

Road Map:

  • Fx46+: Ship a great Desktop experience using Push Notifications.

Currently in active development. Feature may change as decisions are made.

Technologies

High Level Diagram

PushNotificationsHighLevel.png

Engineering Master Bug List: https://bugzilla.mozilla.org/showdependencytree.cgi?id=1201571&maxdepth=2&hide_resolved=1

Push Notification contains the following technologies:

Web Notification API

WebAPI landed in Fx22. Can be used without push and service workers, but will be a popular use case.

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

Service Workers

Service workers is the ability for your browser to run a script in the background enabling offline applications, background processing, and push notifications.

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

Platform: https://wiki.mozilla.org/Service_Workers

Spec: https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html

Push API

Web DOM API that enables a website to subscribe a client, upon granting permission, to send events to the client.

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

draft spec: https://w3c.github.io/push-api/

spec: http://www.w3.org/TR/push-api/

Push Server

Mozilla hosted server that brokers the registration and sending of push events from web app servers to clients. Past terms for this include: SimplePush and WebPush which distinguished low level design and protocol support. For web developers, the server architecture may migrate when appropriate, but the WebAPI will remain the same.

Mozilla Push Service: http://mozilla-push-service.readthedocs.org/

Mobile

Mobile is targeting Fx45+ to for initial support. Android and iOS will leverage Google Cloud Messaging (GCM) and Apple Push Notification Services (APNS) respectively. Work is done by three teams: Android eng, Android platform, and Services Dev. We will be gathering a list of dependencies on landing this on Android.

Android Bug Tree: https://bugzilla.mozilla.org/showdependencytree.cgi?id=1206207&maxdepth=1&hide_resolved=1

Testing

Testing & QA owner is RyanVM. There's a fairly complex test plan here, considering the permissions dialogs, service workers, and API.

Test Plan

FAQ

Does Firefox support encrypted data in Push messages?

Firefox supports the draft spec IETF encryption spec: https://tools.ietf.org/html/draft-ietf-webpush-encryption-01 . Service Workers require HTTPS for it's transport protocol.


How does Push Notifications compare to email when sites want to contact me?

Sites must ask permission to send you a push notification and we've made it easy to disable from site or suppress any notifications until you restart. Web sites offering the push notification will have an anonymized endpoint in which they can send you push messages through Mozilla servers.


How does Push Notifications affect my power usage

Push can actually improve power efficiency for many users. Web site often create their own web sockets or polling request to their own servers to update their website. Multiply that for each web site. Push creates a single web socket for all sites using that service. So you may go from 10 sites connecting to the network to now only a single connection.

You may also leave a tab open or sites may auto refresh at an interval. But with Push, you can close that tab and the site can notify you when you have new mail, message, or content.


What have you changed in the notification UI in Firefox 44?

We've added a gear/ellipsis icon that allows you to quickly suppress notifications, disable for site, and open notification manager. We've changed the on screen display time from four seconds on Windows and Linux to 12 seconds. We've fixed the accessibility announcement for screen readers and we're working on freshening up the UI. If you really want to disable the feature entirely you can go to about:config and change the dom.push.enable to false .


What are recent changes from Mozilla's SimplePush prototypes:

  • Currently the Push API does not access data in the push message, it simply fires an event in the service worker.
  • Push events only work with service workers. SimplePush did not require service workers.
  • The web application does not need to be active tab in client session.
  • about:serviceworkers can be used to manage running service workers.
  • notification permissions cannot be requested inside a service worker, it must be in the web application.


What's the difference between SimplePush and WebPush.

  • They use different DOM APIs.
  • WebPush is intent on implementing the IETF spec. SimplePush was a Mozilla specific implementation and works with FxOS specifically for Find My Device.
  • There are other low level differences in the protocol and background processes.

Communications

email: gGroupsList:

  • Public: dev-push@mozilla.org

irc: #push - IRC info: https://wiki.mozilla.org/IRC

Demos

Requires Firefox 44 or later