Skip to main content
UplinkConnect shows progress for you. If you build your own flow or want progress in your own UI, observe each invocation by its invocationId. There are three ways to do it:
  • InvocationHandle — an @Observable object that streams updates and falls back to polling on its own. Start here.
  • StreamingInvocationSource — the raw server-sent-events stream.
  • HTTPInvocationPoller — plain HTTP polling on your own schedule.
All three produce the same state: a status, a status log, and the output once the invocation finishes.

InvocationHandle

The handle opens the stream immediately, reconnects up to five times, then polls until the invocation finishes. Its properties: handle.cancel() stops observing. It doesn’t stop the run on the server; use client.connectors.cancelRun(sessionId:) for that.

Sign-in state

Connectors report where they are in sign-in on each StatusEntry (stage), which the handle surfaces as signInStage:
  • .connecting — the connector is starting up and checking whether the user is already signed in.
  • .needsSignIn — the site is waiting for the user to sign in. signInDeadline, when set, is when the connector gives up.
  • .signedIn — the user is signed in and the connector is fetching data.
Use .needsSignIn to prompt the user back to the sign-in screen, with a countdown from signInDeadline.

Streaming with StreamingInvocationSource

The stream:
  • Emits the current state on connect, then again every time the invocation changes.
  • Sends a heartbeat every 15 seconds to keep intermediaries from closing the idle connection.
  • Ends when the invocation finishes, which ends the for try await loop.
  • Throws on network failure or a non-2xx response when opening.
If the stream throws or closes before the invocation finishes, reconnect or fall back to polling. InvocationHandle does this for you.

Polling with HTTPInvocationPoller

Under a second between polls keeps the UI responsive without hammering the service. Both the stream and the poller yield an InvocationSnapshot:

Rendering statusLog as a stepper

statusLog is an append-only list of the connector’s progress messages. Render it as a vertical stepper: earlier messages are checked off, the latest is in progress while the invocation is running, and everything is checked off once it completes.

Handling the result

When status is .completed, the output is a JSON object whose fields hold vocabulary types. When it’s .failed, errorMessage says why. See Semantic schemas for finding and decoding the fields you care about.

What’s next

Semantic schemas

Decode output into vocabulary types