Skip to content

mariusbalcytis/real-time-php-sandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Real-time PHP sandbox

Running

cd backend
composer install
cd ..
docker-compose up

Open http://localhost:8000/.

This runs apache server and local poxa instance.

Idea of this sandbox

add.html file sends text to add.php script whenever text in textarea changes. The script saves text into local filesystem and notifies Pusher and local poxa instance about this.

All other files in /frontend and /backend folders are for demonstrating different synchronisation mechanisms available.

Google chrome was used for testing.

Polling

Polling

Long polling

Long polling

Forever frame

Forever frame

Server sent events

Server sent events

Pusher and poxa (WebSockets)

Using real-time proxy

Authentication

authentication.html file demonstrates private- channel support for Pusher and poxa with authentication hook in backend.

Input marius and press Subscribe, then edit text for test to work.

Authentication logic is inside backend/pusher-auth.php. This is just simple example, you should check if JWT token is present, active session exists or user has some kind of cookie - just use your common authentication flows for this.

Make sure you check not only if user is logged in, but if s/he has access to specified channel.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published