{"id":28471,"date":"2018-04-08T12:00:27","date_gmt":"2018-04-08T10:00:27","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/?p=28471"},"modified":"2018-04-08T12:00:27","modified_gmt":"2018-04-08T10:00:27","slug":"how-javascript-works-the-mechanics-of-web-push-notifications","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2018\/04\/08\/how-javascript-works-the-mechanics-of-web-push-notifications\/","title":{"rendered":"How JavaScript works: the mechanics of Web Push Notifications"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p>&#8220;How JavaScript works&#8221; is a series of articles on <a href=\"https:\/\/blog.sessionstack.com\/\">SessionStack<\/a>, describing some of the lesser known bits and pieces of JavaScript.\u00a0 One particular chapter that caught my attention is &#8220;<a href=\"https:\/\/blog.sessionstack.com\/how-javascript-works-the-mechanics-of-web-push-notifications-290176c5c55d\">The Mechanics of Web Push Notifications<\/a>&#8220;.<\/p>\n<blockquote><p>Push and notification are two different APIs.<\/p>\n<ul>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Push_API\">Push<\/a>\u200a\u2014\u200ait is invoked when the server supplies information to a Service Worker.<\/li>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Notifications_API\">Notification<\/a>\u200a\u2014\u200athis is the action of a Service Worker or a script in a web app that shows information to the user.<\/li>\n<\/ul>\n<\/blockquote>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>&#8220;How JavaScript works&#8221; is a series of articles on SessionStack, describing some of the lesser known bits and pieces of JavaScript.\u00a0 One particular chapter that caught my attention is &#8220;The Mechanics of Web Push Notifications&#8220;. Push and notification are two different APIs. Push\u200a\u2014\u200ait is invoked when the server supplies information to a Service Worker. Notification\u200a\u2014\u200athis &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2018\/04\/08\/how-javascript-works-the-mechanics-of-web-push-notifications\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">How JavaScript works: the mechanics of Web Push Notifications<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"How JavaScript works: the mechanics of Web Push Notifications #WebDev #JavaScript #browsers","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_links_to":"","_links_to_target":""},"categories":[1,18,62,1334],"tags":[20,1139,1220,1330],"keyring_services":[],"class_list":["post-28471","post","type-post","status-publish","format-standard","hentry","category-general","category-programming","category-technology","category-web-work","tag-browsers","tag-javascript","tag-notifications","tag-web-development"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":28498,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/04\/19\/service-workers\/","url_meta":{"origin":28471,"position":0},"title":"Service Workers","author":"Leonid Mamchenkov","date":"April 19, 2018","format":false,"excerpt":"A List Apart runs an excellent article \"Going Offline\".\u00a0 In it, among other things, there's one of the simplest explanations of the Service Workers technology that I've seen so far: A service worker is like a cookie. Cookies are downloaded from a web server and installed in a browser. You\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2018\/04\/service-worker-500x193.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":42426,"url":"https:\/\/mamchenkov.net\/wordpress\/2019\/04\/09\/chrome-extensions-php-console-and-javascript-errors-notifier\/","url_meta":{"origin":28471,"position":1},"title":"Chrome Extensions: PHP Console and JavaScript Errors Notifier","author":"Leonid Mamchenkov","date":"April 9, 2019","format":false,"excerpt":"Here are a couple of handy Google Chrome extensions that I came across the other day. PHP Console PHP Console can display PHP errors and var dumps in the Google Chrome Developer Console and notification popups. It can also execute PHP code remotely, with the help of this server side\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2019\/04\/javascript-error-notifier.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2019\/04\/javascript-error-notifier.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2019\/04\/javascript-error-notifier.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":24321,"url":"https:\/\/mamchenkov.net\/wordpress\/2015\/06\/08\/important-announcement-about-sms-notifications-in-google-calendar\/","url_meta":{"origin":28471,"position":2},"title":"Important Announcement about SMS notifications in Google Calendar","author":"Leonid Mamchenkov","date":"June 8, 2015","format":false,"excerpt":"Catching up with emails, I saw this email from the Google Calendar team: Starting on June 27th, 2015, SMS notifications from Google Calendar will no longer be sent. SMS notifications launched before smartphones were available. Now, in a world with smartphones and notifications, you can get richer, more reliable experience\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":11048,"url":"https:\/\/mamchenkov.net\/wordpress\/2008\/02\/06\/odnoklassnikiru-the-way-to-do-site-messages\/","url_meta":{"origin":28471,"position":3},"title":"Odnoklassniki.ru &#8211; the way to do site messages","author":"Leonid Mamchenkov","date":"February 6, 2008","format":false,"excerpt":"After all the comments I received for my\u00c2\u00a0 other post about Odnoklassniki.ru, I decided to expand a little bit on the positive parts of the web site.\u00c2\u00a0 The biggest success of it, except of course for thousands of people registering spreading the word of a mouth, is the messaging system.\u00c2\u00a0\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":21839,"url":"https:\/\/mamchenkov.net\/wordpress\/2014\/05\/20\/rob-ashton-you-have-ruined-javascript\/","url_meta":{"origin":28471,"position":4},"title":"Rob Ashton : you have ruined JavaScript","author":"Leonid Mamchenkov","date":"May 20, 2014","format":"link","excerpt":"Rob Ashton : you have ruined JavaScript Rob talks about \"enterprise\"-level-like frameworks in JavaScript and the complexity of abstractions in some of them. For example, quoting AngularJS framework documentation like this: An Angular \"service\" is a singleton object created by a \"service factory\". These service factories are functions which, in\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":24981,"url":"https:\/\/mamchenkov.net\/wordpress\/2015\/11\/24\/calypso-the-new-wordpress-admin-interface\/","url_meta":{"origin":28471,"position":5},"title":"Calypso &#8211; the new WordPress admin interface","author":"Leonid Mamchenkov","date":"November 24, 2015","format":false,"excerpt":"Matt Mullenweg shares some exciting news - WordPress is getting a major overhaul of its admin interface. \u00a0Completely rewritten in JavaScript, with API support in the backend, it is fast, modern, and will push WordPress right into the future. Check it out on WordPress.com today! \u00a0It shouldn't be too long\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"calypso","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2015\/11\/calypso-232x500.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/28471","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=28471"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/28471\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=28471"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=28471"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=28471"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=28471"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}