All work
17 · infrastructure · real time
Real-time events & streaming
Borrower screens update the moment a background step finishes, and staff see AI answers stream in live, over authenticated connections.
- Client
- US consumer lender
- Role
- Full-Stack Engineer
- Period
- Devinware LLC · ongoing
Problem
Borrowers waited on “please wait” pages while background jobs checked bank data and partner offers. The pages refreshed blindly, and people who closed the tab never heard back.
Staff using the admin AI copilot needed answers to stream into every open tab instead of arriving all at once.
How it works
- 01Application eventA background job finishes, or the AI agent produces the next chunk of an answer.
- 02Broadcast or publishLaravel broadcasts through Reverb; the Node service publishes through Redis pub/sub.
- 03Authenticated connectionBorrowers listen on private per-user channels; staff connect to an authenticated WebSocket server.
- 04UI updateThe waiting page moves the borrower on, or the chat panel renders the streamed answer.
If a borrower leaves
- Disconnect detectedServer-side connection events mark the borrower as gone; a quick reload cancels it.
- Gentle reminderA delayed, capped reminder brings them back to the step they left.
What I built
- Moved the app’s real-time layer from a third-party package to Laravel Reverb, with Laravel Echo private channels in the Vue front end.
- Server-side connect and disconnect listeners that trigger a delayed, capped reminder instead of polling.
- A race-safe handoff state machine on the waiting page (idle → polling → claiming → submitted), so a push, a status poll and a timeout can never navigate twice.
- A Node.js ws server with heartbeats, multi-tab sessions and graceful shutdown, and Redis pub/sub fan-out designed for several worker servers.
- A streaming chat client that reconnects with backoff and keeps every open tab in sync.
Guardrails
- The server, not the event payload, decides what the page acts on.
- Unclaimed events fall back to a server-rendered refresh, so nothing gets stuck.
How it was verified
- Unit tests cover overlapping polls, late events and a result that arrives on the final attempt.
- Node unit tests for the streaming service run in CI.
Result
Waiting pages react to real events instead of blind refreshes, and AI answers reach staff as they are generated.
media note
Client systems are under NDA, so this case study uses words and a diagram instead of screenshots.