What is the difference between Push API and Server Sent Events?

The Push API allows the server to send a notification to a client even when your site is not open, because it relies on service workers. SSE (or WebSockets) work as long as the user is using your site. There are some examples (with documentation) in the Web Push section of the ServiceWorker Cookbook that … Read more

global leak errors in mocha

Yes, Mocha features a global leak detection mechanism which alerts and fails if your code under test introduces global variables. If hasCert is declared in a library and you have no control over its creation, you can tell Mocha to ignore it. On the command line, $ mocha –globals hasCert To quote the documentation: [This … Read more

Android app – detect if app push notification is off

You can check if the user is allowing notifications for your application with this command: NotificationManagerCompat.from(context).areNotificationsEnabled() This one-liner works from API level 19+. However, starting with android O, notification channels are introduced. This allows the user to disable only particular notification channels from the application settings screen and also disable all notifications from the app. … Read more