📜 ⬆️ ⬇️

Push notifications in Firefox 44 and up

image
Now, another browser name has been added to your account.

The release of Firefox 44 is scheduled for January 26, but we have already prepared and implemented its support, because it is now in beta. We describe what the alerts look like in Firefox and how they differ from the alerts in other browsers.

By the way, the incoming alert in Linux looks like this.
')
image

I note that from the previous version the appearance of the alert has changed, now the title is above the picture. Strange decision. It looks like it is not very beautiful. But nothing can be done.



The main advantage is the standard.


Firefox is the first browser to send Push API alerts. Chrome uses the proprietary method of receiving alerts and is attached to the standard with a crutch.

Most likely, other browsers will soon connect to this standard, but Firefox still does not fulfill some of the instructions. For example, in the display of the alert or its parameters.

Man's are described quite messy and easier to understand the development of the example - simple-push-demo.appspot.com
Sources are on Github - github.com/gauntface/simple-push-demo/tree/master/app
I'd add from myself - the only difference from Chrome is that the transferred endpoint can be immediately used for sending. And browsers can be distinguished by just the address in the endpoint.

Main disadvantages


Alerts are sent from the server one by one. If you send them one at a time, one connection, then for each out 1 second. This is a lot. This is due to the use of encryption.

You can send them using one connection. According to our calculations, 32 alerts can be sent in 4-6 seconds. Already not bad.

In the future, we will try to use multi-thread cURL to speed up sending. Restrictions on the number of requests I have not found.

As written above - the look is terrible. But the worst thing is that they disappear in 5 seconds. And at the moment this is not fixed. There is a key in the standard

requireInteraction: true


When using this parameter, the alert should “hang” until the user responds to it. However, Firefox ignores this key.

As in Chrome, alert settings are hidden away, but there is a settings button that will help to unsubscribe from alerts.

Results


If we take the StatCounter data, we now support more than 70% of the browser market for receiving alerts in Russia.

image

If we take the data in the world, about 80%.

image

Unfortunately for IE there is not even a Notification API. Fortunately - we have plans for a version under Windows. We also hope that Opera will either return GCM to its chrome, or take advantage of the open standard.
Also, do not forget that we already have also implemented support for Android, Safari, Telegram, and even email alerts. We hope that soon we will finish the application for iOS and update the Android application.

You can try everything on our website

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


All Articles