{"id":13827016,"url":"https://github.com/MicrosoftEdge/pushnotifications-demo","last_synced_at":"2025-07-09T02:33:14.006Z","repository":{"id":65822902,"uuid":"126245902","full_name":"MicrosoftEdge/pushnotifications-demo","owner":"MicrosoftEdge","description":"Demo for cross browsers push notifications with server side code","archived":true,"fork":false,"pushed_at":"2023-07-18T17:46:08.000Z","size":7195,"stargazers_count":119,"open_issues_count":21,"forks_count":28,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-11-11T16:30:02.987Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MicrosoftEdge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-03-21T22:03:14.000Z","updated_at":"2024-09-29T20:23:14.000Z","dependencies_parsed_at":"2024-01-18T04:09:16.129Z","dependency_job_id":"8467b172-4895-4f5d-b674-31dbbf99bb25","html_url":"https://github.com/MicrosoftEdge/pushnotifications-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicrosoftEdge%2Fpushnotifications-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicrosoftEdge%2Fpushnotifications-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicrosoftEdge%2Fpushnotifications-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicrosoftEdge%2Fpushnotifications-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MicrosoftEdge","download_url":"https://codeload.github.com/MicrosoftEdge/pushnotifications-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225481169,"owners_count":17481164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T09:01:48.484Z","updated_at":"2024-11-20T06:30:44.481Z","avatar_url":"https://github.com/MicrosoftEdge.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Web Push Notifications Tutorial\n\nThis is a tutorial and demo for web push notifications that work in modern web browsers.\n\n## How to use\n\nFirst, install all Node.js dependencies via `npm install`.\n\n**Note**: You will need the necessary tools to compile binaries for node. If you are on a Windows platform the easiest way is to use the [`windows-build-tools`](https://npmjs.com/package/windows-build-tools) package. \n\nThis demo requires access to a mongodb instance for storing push subscription info to send push updates at some other point in time. It also requires specifying a public and private key for identifying your server to the push service's server. These keys, known as VAPID public/private keys, can be generated and printed to the console when first executing the site. The site can be executed by running `node index.js` which will start a server on port `4000`. You'll need to populate those keys as environment variables and execute `node index.js` again to ensure that push messages can be configured from your server.\n\nIf you are using VS Code you can set the environment variables mentioned above in your `launch.json` file as follows:\n\n```js\n{\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n        {\n            \"type\": \"node\",\n            \"request\": \"launch\",\n            \"name\": \"Launch demo\",\n            \"program\": \"${workspaceFolder}/index.js\",\n            \"env\": {\n                \"DATABASE_CONNECTION_URI\": \"YOUR CONNECTION STRING\",\n                \"VAPID_PUBLIC_KEY\": \"YOUR PUBLIC KEY\",\n                \"VAPID_PRIVATE_KEY\": \"YOUR PRIVATE KEY\",\n            }\n        },\n        {\n            \"type\": \"node\",\n            \"request\": \"launch\",\n            \"name\": \"Job\",\n            \"program\": \"${workspaceFolder}/App_data/jobs/triggered/notify/index.js\",\n            \"cwd\": \"${workspaceFolder}/App_data/jobs/triggered/notify\",\n            \"env\": {\n                \"DATABASE_CONNECTION_URI\": \"YOUR CONNECTION STRING\",\n                \"VAPID_PUBLIC_KEY\": \"YOUR PUBLIC KEY\",\n                \"VAPID_PRIVATE_KEY\": \"YOUR PRIVATE KEY\",\n            }\n        }\n    ]\n}\n```\n\nAlternatively, you can modify `configured-web-push.js` and `db/db.js` and set the values there explicitly:\n\n```js\nconst databaseConnectionURI = process.env.DATABASE_CONNECTION_URI || '';\nconst vapidPublicKey = process.env.VAPID_PUBLIC_KEY || '';\nconst vapidPrivateKey = process.env.VAPID_PRIVATE_KEY || '';\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMicrosoftEdge%2Fpushnotifications-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMicrosoftEdge%2Fpushnotifications-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMicrosoftEdge%2Fpushnotifications-demo/lists"}