We all familiar with Facebook Web Push Notification system. The system which Facebook follows needs permission from each visitor who visit's your web page. The notification that we are going to discuss through this article is entirely different from it. This system doesn't require any permission accept from the visitor side to view the notification.

A Brief Introduction to Pusher:

Pusher is a service like Fire-base which allows you to send Push Notification and do many other things that require building an App. From the name we can understand that, The main aim of this service is to serve Push Notification.

The pusher has both Premium and Free plan. You could select the Free Plan at first and you can upgrade to Premium Plan after you reach the limitation of the Free Plan.

How to Configure Real time Notification in Your Website:

It is very easy to integrate the Real-time Push Notification system in your site. All you want to do that the following steps that given below.
  • Go to Pusher.Com and create a free A/c.
  • Click on the "Create New App" Button and create a New App.
  • Once you complete creating App, Get the App Keys.
Pusher API Key
  • In-order to send real-time notification, You need the App Id, Key and Secret code.
  • Now copy and paste the below code to the web page that you need to show the Notification.
<script src="https://js.pusher.com/3.2/pusher.min.js"></script>

    // Enable pusher logging - don't include this in production
    Pusher.logToConsole = true;

    var pusher = new Pusher('Your Key Shere', {
      encrypted: true

    var channel = pusher.subscribe('test_channel');
    channel.bind('my_event', function(data) {
      var not = data.message;

  • Place the code in between the <head> and </head> Tag.
  • Now you can test the code with the "Debug Console" Window of Pusher.
Pusher Debug Testing
  • First click on the "Debug Console" Tab and then change the message to what message you need to sent for testing then click on the "Send Event" Button.
  • Don't forget to open the page which you placed the JavaScript with any web browser to view the Live Notification.

Send Notification Automatically With PHP Script:

Pusher allow you to send notification using PHP and some other major Programming Language. The following code will will help you to send live notification.

  $options = array(
    'encrypted' => true
  $pusher = new Pusher(
    'YOUR APP ID',

  $data['message'] = 'YOUR MESSAGE HERE';
  $pusher->trigger('test_channel', 'my_event', $data);
The above PHP code will allow you to send Real Time Notification to the Web Pages that you placed the Java-script. In-order to run the PHP code, You need to import Pusher Library from Composer. Download the script from this article, It already contains the Composer and Pusher Library.

Suggested Articles for PHP Programmers:

I hope you well enjoyed this article. If you have any doubts or suggestions related to this article. Please let me know by using the comment box that given below. Thanks