PHP Classes

Xaja Notifier: Notify user browsing a site in real time with AJAX

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 60%Total: 464 All time: 6,056 This week: 455Up
Version License PHP version Categories
xaja-notifier 1.0.0MIT/X Consortium ...5.0PHP 5, Databases, Content management, A...
Description 

Author

This package can notify user browsing a site in real time with AJAX.

It takes AJAX requests that perform long polling to send notification messages to users browsing the current site pages.

Browser side JavaScript code can receive the messages immediately and display them to the user.

The package provides an administration interface that can send messages to the users queueing them in a database.

Innovation Award
PHP Programming Innovation award nominee
November 2015
Number 3
Sites like for instance social networks send notifications to the users to let them know about new content, new messages, or actions that they need to take.

This package implements a solution to send notifications to users using AJAX so they can be aware of new notifications without having to load a new page.

Manuel Lemos
Picture of Ettore Moretti
  Performance   Level  
Innovation award
Innovation award
Nominee: 3x

 

Recommendations

Example

<?php
/**
 * Here intercept the ajax call for the administration panel
 *
 *
 *
 * PHP version 5
 *
 * @author Ettore Moretti <ettoremoretti27@gmail.com>
 * @version 1.0.0
 *
 */
set_time_limit(0);

require_once
'core/XajaAdminServer.php';

// Retrieving the last timestamp
$notification=isset( $_GET['notification'])? $_GET['notification']: 0 ;

// Retrieving the uid
$uid=isset( $_GET['id'])? $_GET['id']: 0 ;

//XajaServerClass instance and send notification
$XS= new XajaAdminServer();

$XS->SendNotification($notification,$uid);


Details

xajanotifier

What is XajaNotifier? XajaNotifier is a solution designed to send notifications to users browsing your site in real-time. Using the technique of reverse ajax through the implementation of long polling.

What I could use? Could be very useful in case you want to send any message to all your users online fast and non-invasive.

How do I configure? Db side, import the table that you will find in the package. Server side, change configurations to connect to the db in config.php. Client side configuration is the only one in the script js, where you specify the server address.

Known issues - deliberately (to make scripts as customizable as possible) has been given the opportunity to inject JavaScript code in the message

if not you need it, you may want to inhibit such a possibility ... 
File NotificationSender.php 
Replace: 
	$XS->SendNotification($notification,$uid);
with:
	$XS->SendNotification(htmlentities($notification),$uid);

Screenshots (3)  
  • ClientNotification.png
  • ClientWait.png
  • ServerAdminPanel.png
  Files folder image Files (20)  
File Role Description
Files folder imageCLIENT (1 file, 1 directory)
Files folder imageSERVER (3 files, 3 directories)
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file Xaja_db_export.sql Data sql export

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 60%
Total:464
This week:0
All time:6,056
This week:455Up
User Ratings User Comments (3)
 All time
Utility:81%StarStarStarStarStar
Consistency:68%StarStarStarStar
Documentation:56%StarStarStar
Examples:68%StarStarStarStar
Tests:-
Videos:-
Overall:60%StarStarStarStar
Rank:1223
 
This is a handy package and has many, many uses.
9 years ago (Terry Woody)
80%StarStarStarStarStar
This is just nice nothing else
9 years ago (Samuel Ladapo)
60%StarStarStarStar
This is just nice nothing else
9 years ago (Samuel Ladapo)
60%StarStarStarStar