What this prompt does
This prompt makes the AI implement a real-time [feature_type] feature on Laravel Reverb, scoped by [concurrent_users] connections and [event_frequency] on Laravel [laravel_version]. It walks the full path: configuring Reverb and the Echo client, defining [event_count] broadcast events, wiring channel authorization, building the frontend listeners, adding client events, and scaling for production. Because you declare the connection count and event rate, the AI sizes payloads and scaling instead of producing a demo that only works for one user.
The structure works because real-time fails in the details this prompt forces you to specify. [max_payload_size] and [payload_limit] constrain message size; [event_list] and [channel_count] define the channels and their authorization via [auth_logic]; [client_event_limit] rate-limits whispers for typing indicators; and [process_manager], [horizontal_scaling], and [max_connections_per_user] cover supervised processes and multi-server scaling. The final step asks for tests using BroadcastFake and Event::fake() so the channels stay honest without a running server. Each broadcast event also gets a broadcastWith() payload trimmed under [payload_limit] and a choice between ShouldBroadcastNow and ShouldBroadcast based on how latency-sensitive that event is. Declaring [concurrent_users] and [event_frequency] is what lets the AI reason about message size and queueing instead of broadcasting everything synchronously, and the [reverb_transport] and [max_payload_size] settings keep the server configured for the traffic you actually expect.
When to use it
- You are adding collaborative editing, live cursors, or presence to a Laravel app
- You need presence channels that report who joined and left in real time
- You want typing indicators or cursor sharing via client events with rate limiting
- You expect hundreds of concurrent connections and must plan horizontal scaling
- You want optimistic UI updates that reconcile against server confirmations
- You need feature tests for broadcasting without standing up a live Reverb server
Example output
The AI returns step-by-step Laravel code: Reverb and broadcasting config, Echo client setup via Vite, a set of broadcast event classes with broadcastOn(), broadcastWith(), and broadcastAs(), channel routes in routes/channels.php with private and presence authorization, frontend Echo listeners with reconnection handling and a connection-status indicator, client-event whisper handling, a Supervisor and Redis pub/sub scaling plan, and feature tests using BroadcastFake.
Pro tips
- Keep
[payload_limit]well under[max_payload_size]; lean payloads are what hold up at[event_frequency] - Choose ShouldBroadcastNow only for latency-critical events — broadcasting everything synchronously can starve your workers
- Set
[client_event_limit]deliberately; unthrottled typing/cursor whispers flood the channel under load - Spell out
[auth_logic]precisely so private and presence channels reject users who lack access - Use
[max_connections_per_user]to account for multiple tabs and devices, not just one session - Lean on BroadcastFake and Event::fake() in tests — presence and client events are easy to break silently
- Configure reconnection handling and a connection-status indicator early so dropped sockets recover instead of silently going stale
- Match
[max_payload_size]to your largest realistic event so the transport is not undersized for collaborative edits