• Stars
    star
    188
  • Rank 205,563 (Top 5 %)
  • Language
    CSS
  • Created almost 13 years ago
  • Updated about 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

HTML5 Realtime Push Notifications

HTML5 Realtime Push Notifications using Pusher

PusherNotifier.js

The purpose of the PushNotifier.js library is to make is super easy to add simple Push notifications to any web application. It uses the jQuery Gritter Growl plugin for the UI and Pusher for realtime push notifications.

The first version of this sample shows examples of server functionality in PHP and Ruby with Sinatra. If you'd like to see the example in other languages please get in touch.

How easy is it?

It's as easy as:

  1. Include the PusherNotifier.js libraries and the jQuery Gritter files:

      <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
      <script src="html5-realtime-push-notifications/lib/gritter/js/jquery.gritter.min.js"></script>
      <link href="html5-realtime-push-notifications/lib/gritter/css/jquery.gritter.css"rel="stylesheet" type="text/css" />
      <script src="//js.pusher.com/2.2/pusher.min.js"></script>
      <script src="html5-realtime-push-notifications/PusherNotifier.js"></script>
    
  2. Create a PusherNotifier instance:

      $(function() {
        var pusher = new Pusher('YOUR_APP_KEY');
        var channel = pusher.subscribe('my_notifications');
        var notifier = new PusherNotifier(channel);
      });
    
  3. Trigger events on your server and see them instantly appear in your web app:

    PHP

     $app_key = 'YOUR_APP_KEY';
     $app_secret = 'YOUR_APP_SECRET';
     $app_id = 'YOUR_APP_ID';
    
     $pusher = new Pusher($app_key, $app_secret, $app_id);
     $data = array('message' => 'This is an HTML5 Realtime Push Notification!');
     $pusher->trigger('my_notifications', 'notification', $data);
    

Ruby require 'pusher'

    Pusher.app_id = 'YOUR_APP_ID'
    Pusher.key = 'YOUR_APP_KEY'
    Pusher.secret = 'YOUR_APP_SECRET'

    data = {'message' => 'This is an HTML5 Realtime Push Notification!'}
    Pusher['my_notifications'].trigger('notification', data)

Tutorial

A tutorial explaining how to use the example can be found here: http://pusher.com/tutorials/html5_realtime_push_notifications

Demo

http://html5-realtime-push-notifications.pusher.io/

Examples

PHP

  1. Rename examples/php/config.example.php to config.php and add your Pusher app credentials.
  2. Running on a web server navigate to examples/index.html to see a side-by-side page example and click the 'Notify' button to trigger a notification.

Ruby - sinatra

  1. Rename examples/ruby-sinatra/config_example.rb to config.rb and add your Pusher app credentials
  2. Update examples/notify.html so that the NOTIFY_ENDPOINT has the value /notify
  3. In examples/ruby-sinatra run bundle install to install the dependencies defined in examples/ruby-sinatra/Gemfile
  4. Start the Sinatra server by running bundle exec ruby -rubygems notify.rb
  5. Navigate to http://localhost:4567 (default for sinatra) to see a side-by-side page example and click the 'Notify' button to trigger a notification.

More Repositories

1

pusher-realtime-chat-widget

Example Realtime Chat Widget that can be added to any web page or app.
HTML
97
star
2

react-realtime-chat

Pusher + React = Magic
JavaScript
80
star
3

realtime-commenting

Realtime Blog Comment System
PHP
66
star
4

pusher-webrtc-chat-demo

WebRTC chat application using the DataChannel API and Pusher
JavaScript
63
star
5

pusher-websocket-ruby

Ruby WebSocket client for Pusher Channels
Ruby
61
star
6

html5-realtime-activity-streams

CSS
49
star
7

pusher-realtime-reddit-demo

Demo of the Realtime Reddit API powered by Pusher
CSS
48
star
8

real-time-laravel

Building Real-Time Laravel Apps with Pusher - Workshop
PHP
45
star
9

realtime-twitter-search-angular2

HTML
41
star
10

realtime-twitter-search-vuejs

JavaScript
33
star
11

pusher-js-test-stub

The Pusher Test Stub provide a way of testing your client-side integration with the Pusher JavaScript library and lets you trigger events to ensure that your application behaves in the way you expect it to.
JavaScript
28
star
12

pusher-dotnet-react-chat

A realtime chat application built using ASP.NET Web API, React, and Pusher 😄
JavaScript
27
star
13

pusher-presence-demo

Example of using Pusher's presence functionality for a simple chat demo
Ruby
23
star
14

cyclejs-realtime-chat

JavaScript
23
star
15

pusher-whos-in-gem

Ruby
22
star
16

pusher-realtime-producthunt

Realtime Product Hunt API powered by Pusher
JavaScript
22
star
17

titanium_pusher_ios

Titanium Mobile Module for Pusher on iOS
Objective-C
21
star
18

android-chat-example

A simple chat app with Pusher for Android
Java
20
star
19

customer-support-chat-example

How to create a customer support chat system using Pusher Chatkit
JavaScript
18
star
20

pusher-with-shared-workers

Use Pusher inside a Shared Worker
JavaScript
15
star
21

notifications.js

Easy browser notifications.
JavaScript
13
star
22

pusher-websocket-go

Go client library [[not production-ready]]
Go
12
star
23

pusher-datasource-api

An API for streaming data in real time through Pusher channels.
JavaScript
11
star
24

pusher-realtime-producthunt-extension

Chrome extension using the Realtime Product Hunt API powered by Pusher
JavaScript
11
star
25

titanium_pusher_android

Titanium Mobile Module for Pusher on Android
Java
9
star
26

emberjs-realtime-chat

Pusher + EmberJS Realtime Chat example
JavaScript
8
star
27

LiveCryptocurrencyNotifications

Example app for a blog post on making a live notification for Android
Kotlin
7
star
28

raffle-workshop

A workshop where we build a raffle frontend
HTML
6
star
29

pusher-auth-everything

A small node app that wants to say yes
JavaScript
6
star
30

activity-feed-pusher-react

JavaScript
6
star
31

pusher-nodemcu-client

An experimental NodeMCU Pusher client SDK
Lua
6
star
32

tweet-list

A list of tweets from the twitter streaming api with offline support
JavaScript
6
star
33

pusher-http-perl

Pusher Perl library for interacting with the HTTP API
Perl
5
star
34

web-push-with-pusher

Send browser notifications with Pusher
JavaScript
5
star
35

pusher-elm-ports

Elm
5
star
36

gs-pusher-node

Getting Started: Pusher and Node.js
HTML
5
star
37

pusher-http-scala

Scala library to interact with the Pusher HTTP API
Scala
5
star
38

europython-draw

Prize draw demo for EuroPython 2016
HTML
4
star
39

gs-pusher-php-no-framework

Getting Started: Pusher PHP - No Framework
PHP
4
star
40

pusher-php-silex

An example of using Pusher with the PHP Silex framework
PHP
4
star
41

hackauthon

Or hack - auth off? [[CLI gem to set up channel authentication server for hackathons]]
Ruby
4
star
42

pusher-twitter-streamer

Take tweets from the Twitter stream and trigger a Pusher event
JavaScript
4
star
43

pusher-node-openshift-quickstart

A quickstart template for using Pusher on OpenShift with Node.js
Shell
4
star
44

html5-hacks-thermometer

PHP
4
star
45

real-time-laravel-app

PHP
4
star
46

button

A web app for listening to buttons
HTML
3
star
47

pusher-push-notifications-react-native

Pusher Push Notifications React Native
Objective-C
3
star
48

pusher-jspm-es6

An example of using Pusher with jspm
JavaScript
3
star
49

gs-pusher-aspnet-mvc5

Pusher ASP.NET MVC 5 Getting Started (Work in Progress)
CSS
2
star
50

gs-pusher-java-spark

Get started with Java 8, Pusher and Spark
Java
2
star
51

gs-pusher-python-google-app-engine

QuickStart for using Pusher + GAE w. Python
HTML
2
star
52

pusher-realtime-reddit

Realtime Reddit API powered by Pusher
JavaScript
2
star
53

realtime-legofy

JavaScript
2
star
54

d3-v4-example

An example of using d3 v4
HTML
2
star
55

bee-tracker

An infinite virtual swarm of bees that you can track
JavaScript
2
star
56

sinatra-realtime-server

Ruby
2
star
57

pusher-presence-d3

A demo of using d3 to display presence data
JavaScript
2
star
58

gs-pusher-rails

Get started with Pusher and Ruby on Rails
Ruby
2
star
59

notifications.js-react

JavaScript
1
star
60

notifications.js-getting-started

An example project that uses Notification.js
HTML
1
star
61

pusher-web-components

HTML
1
star
62

ios-chat-example

Swift
1
star
63

hue

Pusher hue demo
JavaScript
1
star
64

pusher-revealjs-remote

A Pusher remote control library for reveal.js
JavaScript
1
star
65

gs-pusher-dotnet

C#
1
star
66

pusher-revealjs-remote-server

A authentication endpoint for the Pusher remote control library for RevealJS
JavaScript
1
star
67

gs-pusher-django

An example for getting started with Pusher, Python and Django.
Python
1
star
68

gs-pusher-ios

The basics of using libPusher - the Pusher iOS Objective-C library
Objective-C
1
star