Re: [push-api] Identifying registrations

On 13 May 2014 06:39, Michael van Ouwerkerk <mvanouwerkerk@google.com> wrote:
> Martin, in Chrome we use registrationId and endpoint for distinct purposes.
> The endpoint is the push server url to which the app server posts new
> messages. The registrationId identifies the correct {device, user, page} to
> which the message will be sent.

I think that the spec needs to be a lot clearer on the purpose (and
usage) of each of these things.  Personally, I think that a better
model would be this:

interface PushManager {
  Promise<PushRegistration> register();
  Promise<sequence<PushRegistration>> registrations();
};

interface PushRegistration {
  Promise unregister();
  attribute DOMString id;
  attribute DOMString endpoint;
};

interface PushMessage {
  attribute PushRegistration registration;
  attribute ?? data;
}

Yes, aside from moving unregister, it's just names, but sometimes
names are important.  The reason behind moving unregister being that
'id' is only present for bookkeeping purposes, and many apps won't
have to use it.

That said, looking at this, I am sorely tempted to suggest adding
EventTarget to PushRegistration and use events.  Any reason that
wouldn't be appropriate?

p.s., I assume that the mess in the editor's draft regarding
PushManager is due to a Respec.js issue around the use of promises.

Received on Tuesday, 13 May 2014 17:10:37 UTC