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@Observableobject 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.
InvocationHandle
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 eachStatusEntry (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.
.needsSignIn to prompt the user back to the sign-in screen, with a countdown from signInDeadline.
Streaming with StreamingInvocationSource
- 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 awaitloop. - Throws on network failure or a non-2xx response when opening.
InvocationHandle does this for you.
Polling with HTTPInvocationPoller
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
Whenstatus 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