Client Monitor multiplayer
See every open connection to this site, with an identicon and a masked IP address. Open another tab and it appears. The onClientConnect and onClientDisconnect hooks broadcast the page's ROUTE scope, and getClients() lists the streams.
Hook-driven updates: the client list re-renders only when someone connects or disconnects. No polling, no timer, no wasted cycles.
getClients() returns every open SSE stream, on every worker, with its identicon, IP address, and connection time. Open multiple tabs to see them appear.
Masked IP addresses: every visitor sees this list, so it shows only the network of each address: the first two octets of an IPv4 address, the first 32 bits of an IPv6 address.
getClients() itself returns the full address.onClientConnect / onClientDisconnect hooks fire globally. This example broadcasts to the monitor's ROUTE scope inside each hook.
Identicons give each connection a visual fingerprint. The server draws them from a random id each tab gets when its stream first connects.
ROUTE scope means every viewer of this page shares the same rendered output. The hook broadcasts once and all clients receive the same HTML patch.
Zero idle cost: unlike a timer, hooks fire only in response to real events, and
countClients() skips the broadcast while nobody has this page open on any worker.Connected Clients (0)
Every visitor sees this list, so IP addresses show only their network.
Views
client_monitor.html.twig
Re-renders on connect/disconnect hooks via ROUTE broadcast. Shows identicons, masked IP addresses, and connection duration.