Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31732 > unrolled thread

Chrome and Push API

Started byAlice Wonder <mpeters@domblogger.net>
First post2016-11-18 08:12 -0800
Last post2016-11-25 23:18 +0100
Articles 3 — 3 participants

Back to article view | Back to comp.lang.javascript


Contents

  Chrome and Push API Alice Wonder <mpeters@domblogger.net> - 2016-11-18 08:12 -0800
    Re: Chrome and Push API Richard Maher <maher_rjSPAMLESS@hotmail.com> - 2016-11-19 10:53 +0800
    Re: Chrome and Push API Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-11-25 23:18 +0100

#31732 — Chrome and Push API

FromAlice Wonder <mpeters@domblogger.net>
Date2016-11-18 08:12 -0800
SubjectChrome and Push API
Message-ID<72e18e2d-3896-47eb-b5ac-b3a1fcb4c837@googlegroups.com>
Web application for providing audio content to users. It's not officially launched yet.

I started using the Push API so that when a user finds audio content they like, they can subscribe to that content provider and get notifications when that provider uploads new content.

It is working fantastically with FireFox 49.

The subscription is activated by a button inside a div. Initial state of button is disabled.

on pageload, JS checks for "serviceWorker" in navigator and then checks for "showNotification" in ServiceWorkerRegistration.prototype and then checks for Notification.permission !== "denied" and finally checks for "PushManager" in window

If any of those tests fail the button remains disabled and the div has its display set to hidden.

So the button to subscribe should only be available on platforms that actually support the feature.

In FireFox everything is working both on desktop browser and on FireFox for Android.

I don't have access to Chrome for Desktop, Google doesn't support Chrome on CentOS 7 which is my desktop.

But Chrome on Android, the subscribe button is shown and activated indicating Chrome on Andoid supports what is needed - but it doesn't work.

From looking around the web, I got the impression from several sources that a manifest.json is required for Push API to work for Chrome (which is odd, the W3C specification says nothing about needing that) so I created and populated a manifest.json and made the link tag pointing to it.

Chrome for Android still won't allow push subscription.

Does anybody know what is going on? What chrome wants?

The service worker and JavaScript the pages use to install the service worker are JSLint compliant (other than using in instead of hasOwnProperty but that's stylistic, not an actual error), the service worker only listens for the push event.

But the endpoint isn't even being created on chrome for android for me to test the push on that platform.

There must be something chrome is looking for that isn't in the specification, and I can not figure out what it is.

Chrome's documentation on service workers and push API is useless to me as it assumes the chrome developer tools are being used, so I followed the mozilla documentation. But something extra (beyond a manifest.json) is clearly needed for chrome and I can't figure out what it is.

Thank you for any assistance.

[toc] | [next] | [standalone]


#31733

FromRichard Maher <maher_rjSPAMLESS@hotmail.com>
Date2016-11-19 10:53 +0800
Message-ID<o0oer4$jog$1@gioia.aioe.org>
In reply to#31732
First hit on Google: -
https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web

you have to register with Google.

Please, PLEASE, *PLEASE* tell anyone and everyone that you need a 
broadcast API as support by GOOGLE Microsoft, and Apple for native apps!

[toc] | [prev] | [next] | [standalone]


#31739

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-11-25 23:18 +0100
Message-ID<1743567.pCc8Et7v6t@PointedEars.de>
In reply to#31732
Alice Wonder wrote:
^^^^^^^^^^^^
Is that your real name?

> […]
> I don't have access to Chrome for Desktop, Google doesn't support Chrome
> on CentOS 7 which is my desktop.

No, that is your Linux distribution.  (Your desktop is probably GNOME.)

,-<https://www.centos.org/about/>
| 
| The CentOS Linux distribution is a stable, predictable, manageable and 
| reproducible platform derived from the sources of Red Hat Enterprise
| Linux (RHEL).

So you can certainly install Chrome there, however I would suggest Chromium 
instead.
 
> But Chrome on Android, the subscribe button is shown and activated
> indicating Chrome on Andoid supports what is needed - but it doesn't work.

Chrome on Android is a different environment than Chrome on the desktop, the 
same as Firefox on Android is different from Firefox on the desktop.
 
> Does anybody know what is going on? What chrome wants?

<http://catb.org/esr/faqs/smart-questions.html>
 
> The service worker and JavaScript the pages use to install the service
> worker are JSLint compliant (other than using in instead of hasOwnProperty
> but that's stylistic, not an actual error),

Use JSHint & friends instead.

> the service worker only listens for the push event.
> 
> But the endpoint isn't even being created on chrome for android for me to
> test the push on that platform. […]

  “Talk is cheap.  Show me the code.”
    —Linus Torvalds
 
-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web