https://github.com/philnash/the-web-is-getting-pushy
An example of push notifications and service workers
https://github.com/philnash/the-web-is-getting-pushy
Last synced: 3 months ago
JSON representation
An example of push notifications and service workers
- Host: GitHub
- URL: https://github.com/philnash/the-web-is-getting-pushy
- Owner: philnash
- Created: 2015-06-04T09:48:59.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-01T22:07:59.000Z (over 9 years ago)
- Last Synced: 2025-04-14T03:53:39.287Z (6 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 9
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Push notifications with Service Worker
This repo is an example of push notifications in the browser based on getting notified of new tweets to a chosen hashtag.
This currently works in Chrome version 42 and above and requires Node.js to run.
## Preparing the application
Clone this repo and install the dependencies.
$ git clone https://github.com/philnash/the-web-is-getting-pushy.git
$ cd the-web-is-getting-pushy
$ npm installCopy the `.env.example` file to `.env`.
$ cp .env.example .env
Fill in your credentials in `.env`.
To do this, you will need a [Twitter application](https://apps.twitter.com) and a [Google Project](https://console.developers.google.com/project).
Create an [application](https://apps.twitter.com/app/new) (it only needs read capabilities) and generate an access token too. Then copy the consumer key, consumer secret, access token and access token secret to the `.env` file.
Log in to the [Google Developers Console](https://console.developers.google.com/project) and create a project. Once the project is created, go to the APIs menu item, under APIs & auth, search for "messaging" and enable "Google Cloud Messaging for Chrome". Then go to the Credentials menu item and find the API key. Copy that into the `.env` file too.
You will also need the project number. To find this go to the project overview and the project number is at the top of the screen. Copy that and enter it as the `gcm_sender_id` in `public/manifest.json`.
### Hashtag
Choose a hashtag to follow, something reasonably popular will give you a good number of notifications to test with. Enter the hashtag in `.env`.
## Run the application
Run the app by typing on the command line:
$ npm start
The application should be running at [http://localhost:3000/](http://localhost:3000/). Click the button to give your permission to receive notifications and wait for them to start.