All Projects → realtime-framework → Webpushnotifications

realtime-framework / Webpushnotifications

Licence: mit
Example website using Web Push Notifications with Realtime Pub/Sub Messaging service and Firebase Cloud Messaging

Projects that are alternatives of or similar to Webpushnotifications

Wsify
Just a tiny, simple and real-time self-hosted pub/sub messaging service
Stars: ✭ 452 (+307.21%)
Mutual labels:  realtime-messaging
Mangosta Ios
MongooseIM client for iOS
Stars: ✭ 28 (-74.77%)
Mutual labels:  realtime-messaging
Rctrealtimemessagingandroid
Realtime Cloud Messaging React Native SDK for Android
Stars: ✭ 52 (-53.15%)
Mutual labels:  realtime-messaging
Applozic Android Sdk
Android Real Time Chat & Messaging SDK
Stars: ✭ 611 (+450.45%)
Mutual labels:  realtime-messaging
Web Msg Sender
Web message pusher written in PHP based on workerman.
Stars: ✭ 864 (+678.38%)
Mutual labels:  realtime-messaging
Ionic Firebase Chat
Create a Real Time Chat App with Ionic && Firebase
Stars: ✭ 33 (-70.27%)
Mutual labels:  realtime-messaging
ansible-api
A RESTful HTTP Api for Ansible
Stars: ✭ 122 (+9.91%)
Mutual labels:  realtime-messaging
Applozic Ios Sdk
iOS Real Time Chat & Messaging SDK
Stars: ✭ 104 (-6.31%)
Mutual labels:  realtime-messaging
Chatify
A Laravel package that allows you to add a complete user messaging system into your new/existing Laravel application.
Stars: ✭ 885 (+697.3%)
Mutual labels:  realtime-messaging
Engine And Editor
Streamr Core backend
Stars: ✭ 44 (-60.36%)
Mutual labels:  realtime-messaging
Gatewayworker
Distributed realtime messaging framework based on workerman.
Stars: ✭ 801 (+621.62%)
Mutual labels:  realtime-messaging
Realtime Sdk Flutter
LeanCloud Flutter Plugin SDK
Stars: ✭ 22 (-80.18%)
Mutual labels:  realtime-messaging
Rx.wamp
An RX wrapper library for Wamp in the browser and node
Stars: ✭ 37 (-66.67%)
Mutual labels:  realtime-messaging
Gamenetworkingsockets
Reliable & unreliable messages over UDP. Robust message fragmentation & reassembly. P2P networking / NAT traversal. Encryption.
Stars: ✭ 5,795 (+5120.72%)
Mutual labels:  realtime-messaging
Agora Flutter Rtm Sdk
Flutter wrapper around the Agora Real Time Message SDKs for Android and iOS
Stars: ✭ 62 (-44.14%)
Mutual labels:  realtime-messaging
go-gin-web-server
Deploy Go Gin on Render
Stars: ✭ 23 (-79.28%)
Mutual labels:  realtime-messaging
Ably Go
Go client library SDK for Ably realtime messaging service
Stars: ✭ 29 (-73.87%)
Mutual labels:  realtime-messaging
Rltm.js
Easily swap realtime providers with a single code base
Stars: ✭ 106 (-4.5%)
Mutual labels:  realtime-messaging
Ably Js
Javascript, Node, Typescript client library SDK for Ably realtime messaging service
Stars: ✭ 99 (-10.81%)
Mutual labels:  realtime-messaging
Kotlin Firebase Group Chat
Group and OneonOne chat using firebase built in Kotlin similar to whatsapp.
Stars: ✭ 44 (-60.36%)
Mutual labels:  realtime-messaging

Web Push Notifications with Realtime

This project shows how to use the Web Push Notifications API in a website, allowing easy engagement with users that are currently not browsing the website. This project uses the Realtime Messaging JavaScript SDK and requires Chrome 50+ or Firefox 44+.

Realtime + Web Push Notifications guide

  • Register to get your free Realtime Messaging application key at https://accounts.realtime.co/signup/

  • Create a Firebase Cloud Messaging project. Follow this tutorial.

  • Open the index.html file and replace the Firebase initialization code shown below with the configuration code you got in the previous step:

        <!-- START INITIALIZATION CODE -->
        <script src="https://www.gstatic.com/firebasejs/3.5.0/firebase.js"></script>
        <script>
          // Initialize Firebase
          var config = {
            ...
          };
          firebase.initializeApp(config);
        </script>
        <!-- END INITIALIZATION CODE -->
    
  • In the index.js file replace the Realtime demo application key (K4xqxB) with your own Realtime application key:

      var RealtimeAppKey = "K4xqxB"; 
    
  • Edit the service-worker.js file enter your Firebase Sender ID in the messagingSenderId property:

      firebase.initializeApp({
        'messagingSenderId': '915139563807'
      });
    
  • Map a webserver to folder where you have cloned this repository, open http://localhost/index.html in your Chrome/Firefox browser and try it out. If it doesn't work as expected have a look at the limitations and troubleshooting sections below.

Limitations

  1. This will only work on Chrome 50+ and Firefox 44+
  2. If you are not using localhost you must use the https protocol (it will work on localhost with http)
  3. At least one Chrome/Firefox tab must be opened in order to receive push notifications

Troubleshooting

  • If you get the following error message it means you have changed the gcm_sender_id in your manifest.json file. Please update your manifest and enter the exact value shown in the message:

      Messaging: Please change your web app manifest's 'gcm_sender_id' value to '103953800507' to use Firebase messaging. (messaging/incorrect-gcm-sender-id).
    

Not receiving push notifications

  • Check that you are running the example from a webserver (e.g. http://localhost) and not from the file system (e.g. file:///C:/web/WebPushNotifications-master/index.html);

  • Check that you have entered the right Firebase configurations;

  • Don't forget to give permissions for the push notifications when your browser requests them;

  • Make sure your webserver is properly configured to serve the file manifest.json (check if there are no 404 errors in your browsers Developers Tool network tab). IIS users may need to add the MIME type;

  • If you're not using localhost make sure you are using the https protocol with a valid SSL certificate for the domain you are using;

  • Check if you have any other browser tab opened using the website you're testing. If you do, make sure that page has a Realtime connection established and is subscribing the push notification channel. Push notifications won't be displayed to users that are currently browsing the site that originated the push.

Private channel vs Global channel

If you want to control to which users you are sending each push you should use a private channel for each user. If you want to broadcast a push notification to all users you should use a global channel that every user subscribes.

A mixed private/global channel strategy can also be used, it really depends on your use case.

On-line example

You can test the Realtime Web Push Notifications here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].