Skip to content

app/: live updates over SSE (sc-8900, ported sc-8897) - #94

Closed
ndbroadbent wants to merge 1 commit into
laravel-forge-syncfrom
laravel-sse
Closed

ndbroadbent wants to merge 1 commit into
laravel-forge-syncfrom
laravel-sse

Conversation

@ndbroadbent

Copy link
Copy Markdown
Member

Ports live updates to app/.

  • GET /api/ui/orgs/{org}/projects/{project}/live and .../builds/{number}/live: server-sent events on Postgres LISTEN/NOTIFY (live::subscribe). A changed event goes out at most every 300 ms. A lagged receiver or the * topic sends one too, so a page that missed notifications reads everything again. Streams end after 30 minutes or at shutdown, and send a keep-alive every 15 seconds.
  • Who can read: anyone for a public project, members otherwise; everyone else gets a 404.
  • What triggers updates: tell_open_pages on BuildChanged, plus build creation and processing in http/api/builds.rs.
  • Frontend: useLive invalidates the page's queries on changed and when the stream reopens. Polling runs only while no stream is open.
  • Tests: app/tests/live_pages.rs (5 tests) and src/__tests__/live.test.tsx (3 tests). docs/design.md describes it under Stack and hosting.

Stacked on #77 (laravel-forge-sync). It will be retargeted to main when #77 merges.

… and a build page each follow a server-sent event stream (GET …/projects/{project}/live and …/builds/{number}/live) and read their data again when it says changed; the streams carry no data of their own, are open to the project's members (anyone for a public project, a 404 otherwise, as the pages), gather a burst of notifications into one event, say changed after a reconnection or when they fell behind, and end after 30 minutes so the browser reconnects and access is checked again; BuildChanged, a new build and a build starting to process notify build:<id> and project:<id>; the frontend's useLive hook invalidates the page's queries and the pages poll only while no stream is open (today's server has none); design doc
@ndbroadbent
ndbroadbent marked this pull request as draft December 3, 2026 00:00
ndbroadbent added a commit that referenced this pull request Dec 3, 2026
ndbroadbent added a commit that referenced this pull request Dec 3, 2026
ndbroadbent added a commit that referenced this pull request Dec 3, 2026
ndbroadbent added a commit that referenced this pull request Dec 3, 2026
* Blog draft: a Laravel Rust starter kit for a production SaaS

* Blog: publish the starter kit post; live updates did make the cutover

* Blog: live updates are the transport only; the SSE streams are in #94; keep the rewrite post's sentence

* Blog: the starter kit's description doesn't promise live updates yet
@ndbroadbent

Copy link
Copy Markdown
Member Author

Superseded by #149: rebuilt on current main and fixed against the review findings (a snapshot on every open, connection limits, the shared Principal including vca_ tokens, and the CLI's --wait).

@ndbroadbent ndbroadbent closed this Dec 3, 2026
ndbroadbent added a commit that referenced this pull request Dec 3, 2026
…s --wait (sc-8897, sc-8900); CLI 0.2.23

Every stream starts with a snapshot of the current state; streams authorize with the same Principal as the API and
MCP (vca_ tokens on their own resource); open streams are capped per principal, per build and per process (429 with
Retry-After); idle streams hold no database connection. The CLI's --wait follows /api/v1/live/builds/{id} and falls
back to polling when there's no stream. Supersedes #94.

Co-Authored-By: Claude <noreply@anthropic.com>
ndbroadbent added a commit that referenced this pull request Dec 3, 2026
…s --wait (sc-8897, sc-8900); CLI 0.2.23 (#149)

Every stream starts with a snapshot of the current state; streams authorize with the same Principal as the API and
MCP (vca_ tokens on their own resource); open streams are capped per principal, per build and per process (429 with
Retry-After); idle streams hold no database connection. The CLI's --wait follows /api/v1/live/builds/{id} and falls
back to polling when there's no stream. Supersedes #94.

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant