📜 ⬆️ ⬇️

PushAll can send notifications to the Chrome browser without installing applications and add-ons

How?


Google Chrome since version 42 supports Push API through Google servers using GCM. You probably already saw these requests for access to notifications. If you allow access, the site will be able to send you notifications. This function is completely new, and very few people know about it, however, in my opinion, it already has major shortcomings:


An intermediate service that takes care of all these functions can solve problems that arise.



')


Some theory


The main article on which I actually did this function can be found here.
In short, the browser creates a Service-Worker (available from Chrome 40), this is a background process on JS. He does not always work in the background, but responds to various requests from the outside. For example, on the arrival of Push-messages. Of course, it does not require an open page. Moreover, it works even if the browser is closed (well, not completely closed, but in the background.)

When a push message arrives, the browser shows notifications. That's all. This allows you to fully implement the receipt of Push-notifications without any applications, moreover, it works on Android in mobile chrome! Of the obvious flaws, it is possible to single out at the moment that it is impossible to transmit a payload in a push message, i.e. the message itself. Google explains this by security issues, and reports that the Chrome 44 problem is completely solved and the browser will be able to receive data directly. Also, according to some information, if the browser has been closed, then the request will not reach it. This problem is solved by the fact that you can throw out all the notifications that were not confirmed when you receive any of the next message.

How PushAll Solves a Problem


You can send notifications via Push API even without a website at all. That is, you can create a feed and send notifications manually, either from the server via curl, or by connecting an RSS feed. In this case, the user allows access to the PushAll website.
In this case, the developer does not need to think about whom he sends the notification. On the application for Android, on the addition of chrome, or immediately through the Push API. He can send a message to the top ten users, but in fact it will go to each of the 2-3 devices of each user. In the future, it will be other browsers and other platforms, such as iOS and WP.

Testing


The function was written just yesterday and therefore testing is required.

To test notifications via Push API, you need to go to PushAll.ru and log in using your Google account.


Immediately after entering you will be taken to the channel catalog. There is a switch on the top right that includes a new feature.


After switching on, chrome will ask you for access to notifications. After that, go to the profile section and "pinganut" device


Write me in a personal, or in the comments, how the notifications work. Some had problems with the work of the notifications, and I would like to correct the situation. Also check the notifications on your Android smartphone. As you test, I think you will find a couple of interesting channels in the catalog.

Immediately so that there are no questions: it is not necessary to receive all notifications from the channels. Subscribed to the channel, opened it again - they opened the filter, entered keywords. On those topics that are important to you first of all, notifications will be sent immediately to the devices, and you can read the rest from the sites themselves (this applies to the example of the Shahr channel or the TV series channels)

Perspectives


This feature allows you to reach a large audience of users. Many find it difficult to put an application or addition, however, to press a couple of buttons is not difficult.
In the future, I will write a special widget for sites. It will be possible to do 4 things at once with one click.

That is, the user clicks on the button, he will be asked to access Google account, ask access to notifications - that's all. The user is ready to receive notifications. Moreover, if the user then downloads the application for any other platform, he will continue to receive notifications from your site, until he himself unsubscribes from them in his personal account. At the same time, my service allows you to send notifications even to mobile devices without installing an application!

Source: https://habr.com/ru/post/260181/


All Articles