Skip to content

Latest commit

 

History

History
58 lines (34 loc) · 1.47 KB

readme.md

File metadata and controls

58 lines (34 loc) · 1.47 KB

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.