Skip to main content
Live updates stream a build to the builder’s browser as it happens, including each message, tool call, status change, and preview reload, so you don’t have to poll. Your server opens a short-lived session for the apps a page shows, and the browser connects with it through the Platform SDK. Everything that changes the app still goes from your server to the Apps API, since the live connection is read-only.
Live updates are in beta and need the Builder plan or higher. Ask your onboarding contact to turn them on for your workspace. Until they’re on, poll for the build’s state.
From opening a page to the first live events:

Set up live updates

Before you begin: Create a workspace API key with the Watch app builder updates permission, and give it access to every app your builders can watch. Choose All current and future apps so you don’t have to update the key when you add an app. Keep this key on your server.
1

Open a session

Add an endpoint on your server that the browser calls when it needs live updates for specific apps. Check that the signed-in builder has access to each of those apps. Then use Create socket session to open a short-lived session that lets the browser watch those apps:
The response carries session_id, session_token, socket_url, and socket_path. Return session_token, socket_url, and socket_path to the browser, and keep session_id on your server.A session watches up to eight apps for one hour, and expires_in gives that time in seconds. Sessions are never extended, so open a new one on every call and don’t return a cached token.
2

Connect from the browser

The browser connects with the session your endpoint returns, using the Platform SDK. Install @base44/platform, create a client with createPlatformClient(), and call client.chat.init() once per page.In the options, pass a getSession() function that calls the endpoint you added in the previous step and returns its JSON. The SDK connects to the socket_url and socket_path in that JSON.Then subscribe to each app you want to watch, connect, and clean up when the page closes:
Each browser tab needs its own session. A second connection with the same token replaces the first, so don’t share a token between tabs. If the connection drops, the SDK retries five times and rejoins every active subscription with a fresh snapshot. The SDK calls getSession() again when the session expires or Base44 rejects its token. For every option and method, see the client reference.
3

Apply snapshots and events

When you subscribe to an app, onSnapshot() receives the app’s current state first, including the build status, the last 50 messages, and the prompt queue. Then onEvent() receives each live event, in order.Follow these rules when you apply a snapshot or an event:
  • Replace: Replace what you hold for the app with the snapshot, including the build status, the messages, and the prompt queue. To show older history, load it with Read conversation messages.
  • Missing isn’t empty: If an event leaves out a field, keep the value you have. If an event sets a field to null, clear it.
  • Branches: An event with a branch_id belongs to that branch. An event with no branch_id, or with branch_id set to null, belongs to the main branch.
Live messages and HTTP messages are different shapes. The transcript from Read conversation messages carries the AI’s raw tool calls. Live messages carry only the fields listed in Socket messages. Map the HTTP messages into the live shape so one set of components renders both.
Look up any event and its fields in Socket messages. If an error comes back, PlatformSocketError explains each code and what to do about it.

Change a session’s apps

You can change which apps a session watches at any time from your server. Using the session_id you kept in the first step, call Add app to session to add an app or Remove app from session to remove one. After you remove an app, a connected browser stops receiving its updates right away. When the page closes, call End socket session from your server to end the session and disconnect the browser.

Answer questions

During a build, the AI sometimes pauses to ask a question. The question arrives as a tool call in message.updated, with status set to waiting_for_user_input. Show the question in the browser. Your server then sends the answer with Submit tool-call input, the same call you use in the build turn.

See also