Skip to content
No description, website, or topics provided.
HTML PHP
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
backend
frontend
img
.gitignore
authentication.html
docker-compose.yml
index.html
readme.md

readme.md

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.

You can’t perform that action at this time.