WebSockets PHP Demos › User Logger

Authored by
@cballou on twitter
fork on github

In this demo, we demonstrate the most basic WebSocket functionality. We're only handling a single message type which broadcasts your browser information to all other connected users. Think of this as the precursor to a user-aware sidebar widget, much the same as you'd see on a forum displaying connected users but in realtime. The WS server simply acts as an intermediary, distributing JSON encoded messages to all connected clients via open socket connections. It is the responsibility of the client-side JavaScript to parse and interpret these messages.