About This Project
A clean PHP + browser demo for long-lived WebSocket connections
Purpose
This project demonstrates a persistent WebSocket connection where each client sees its own uptime updated every second by the server.
Features
- Manual connect/reconnect/disconnect controls in the main UI.
- Server-pushed per-client uptime every 10 seconds.
- JSON message protocol (
connected,uptime,ping,pong). - Minimal test page for quick endpoint verification.
Technology Stack
Request Flow
- Browser opens a WebSocket to
/ericyanws(or a custom endpoint via query string). - Server upgrades the connection and records
connected_atper client. - Every tick, the server publishes uptime messages for each active client.
- Frontend updates timer and server timestamp in real time.