Live data from Hacker News

Push.js – A minimalist JavaScript library for desktop notifications

github.com

31–40 of 40 posts

Re: Push.js – A minimalist JavaScript library for desktop notifications

#32
post #5

I hate to be pedantic but these are not push notifications. Those are the ones that can be sent even if the webapp is closed, for example, this Chrome demo: https://developers.google.com/web/fundamentals/getting-start...

I've built a plug & play app for Web Push Notifications. It comes with an analytics dashboard and an interface for users to manage their subscription. If anyone is interested to try it, you can see the demo at https://www.pushroll.com

Re: Push.js – A minimalist JavaScript library for desktop notifications

#33
post #3

I just downloaded this and made a 1-liner to try it out. Really cool. Worked just fine in FF. Not sure why it didn't do anything in Chrome on Mac. > setInterval(function() { Push.create('Hi') }, 2000);

I too had this issue. I appears that notifications don't show in full screen mode. When I returned Chrome to a windowed app on my Mac the notifications appeared.

Re: Push.js – A minimalist JavaScript library for desktop notifications

#34
post #33
post #3

I just downloaded this and made a 1-liner to try it out. Really cool. Worked just fine in FF. Not sure why it didn't do anything in Chrome on Mac. > setInterval(function() { Push.create('Hi') }, 2000);

I too had this issue. I appears that notifications don't show in full screen mode. When I returned Chrome to a windowed app on my Mac the notifications appeared.

I think I ran into the issue before as well.. however, I think that's an issue with how Chrome handles its notifications. I don't think there's anything in the library that could cause this behavior. A known issue is that the library is currently broken in Safari. I will investigate why when I have some free time.

Re: Push.js – A minimalist JavaScript library for desktop notifications

#37

Not working on Safari.

Does not seem to work locally using Chrome 50.0.2661.102 (64-bit) either. Not a good sign.

I just tested on Chrome 50.0.2661.102 (64-bit) on OSX 10.11.4 and it seems to work. What OS are you running? Did it ask you permission to show notifications? Are there any errors in the developer console?

Re: Push.js – A minimalist JavaScript library for desktop notifications

#38
Quick apology for confusing the terms "push notification" and "desktop notification". I forgot "push" usually refers to sites that use service workers to send notifications to the desktop regardless of whether the browser window is open. This library requires the window remain open for the notification to be shown.

Re: Push.js – A minimalist JavaScript library for desktop notifications

#39
In the web app I work on, we have a toast component that we use to show the user status messages. It's usually used for showing error messages. I've been aware of desktop notifications being around or a couple years now, but I haven't used em.

What guidelines or general rule of thumb do you use when deciding if something is worth a notification?

Re: Push.js – A minimalist JavaScript library for desktop notifications

#40
post #23

Earlier quoted context omitted.

Why would it require HTTPS? This is a javascript library that allows you to hook into a native browser function (showing desktop notifications). There are no web services involved.

https://developers.google.com/web/updates/2015/03/push-notif... Why does this require HTTPS? How do I work around this during development? Service workers require secure origins to ensure that the service worker script is from the intended origin and hasn’t come about from a man-in-the-middle attack. Currently, that means using HTTPS on live sites, though localhost will work during development.

To answer the "how do I work around this during development": non-HTTPS is permitted on localhost (this is at least the case in Chrome). The spec also hints at this (https://w3c.github.io/push-api/#security-and-privacy-conside...). But, as has already been mentioned, this is about desktop notifications and not web push.
Post reply on HN