Skip to content

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

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

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

This branch has not been deployed

No deployments
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