Re: Push API and Service Workers

The hard question is: What do you do if there's an incoming push
message for a given website, but the user doesn't have the website
currently open.

Service Workers provide the primitive needed to enable launching a
website "in the background" to handle the incoming push message.

Another solution would be to always open up a browser tab with the
website in it. But that's only correct behavior for some types of push
messages. I.e. some push messages should be handled without any UI
being opened. Others should be opened by launching a "attention
window" which is rendered even though the phone is locked. Others
simply want to create a "toast" notification.

We could add lots of different "types" of push messages. But that's a
lot of extra complexity. And we'd have to add similar "types" of
geofencing registrations, and "types" of alarm clock registrations,
etc.

The current design separates the "trigger" from "what to do when the
trigger fires". Which both makes for a smaller API, and for a more
flexible design.

/ Jonas



On Wed, Oct 15, 2014 at 2:42 PM, Shijun Sun <shijuns@microsoft.com> wrote:
> Hi,
>
>
>
> I'm with the IE Platform team at Microsoft.  I joined the WebApps WG very
> recently.  I am looking into the Push API spec, and got some questions.
> Hope to get help from experts in the WG.
>
>
>
> The current API definition is based on an extension of the Service Workers.
> I'd like to understand whether the Service Workers is a must-have dependency
> for all scenarios.  It seems some basic scenarios can be enabled without the
> Service Worker if the website can directly create a PushRegistrationManager.
> I'm looking at Fig. 1 in the spec.  If the user agent can be the broker
> between the "Push client" and the webpage, it seems some generic actions can
> be defined without the Service Workers - for example immediately display a
> toast notification with the push message.
>
>
>
> It is very likely I have missed some basic design principle behind the
> current API design.  It'd be great if someone could share insights on the
> scenarios and the normative dependency on the Service Workers.
>
>
>
> All the Best, Shijun
>
>

Received on Wednesday, 15 October 2014 22:34:01 UTC