PHP WebSockets
summary
Builds a WebSocket server in pure PHP using Ratchet, listens on port 8080, and uses simple JSON messages with types like startRaffle, registerPlayer and pickWinner. Implements a raffle: host starts (password checked as hunter2 for the demo), server returns join code ABCD, players register by name, server shuffles a copy of the players array and picks a winner, broadcasts winner/loser messages to all connections. Demo runs (Heroku required a 30s timeout workaround with pings every ~20s); not production hardened (no auth standard, reconnection, or dropped-connection cleanup).
AI-written summary · about
