Platform

Configuration

Customize PipeKit to fit your app's needs.

Basic Configuration

Initialize PipeKit in your app entry point — the AppDelegate on iOS, or the Application subclass on Android:

AppDelegate.swift
import PipeKit
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
PipeKit.configure(
apiKey: "pk_live_your_api_key",
config: PipeKitConfig(
enableSessionReplay: true,
enableFlows: true,
captureNetwork: true,
captureConsoleLogs: true
)
)
return true
}

Configuration Options

These options are available on PipeKitConfig on both platforms (types shown as iOS / Android):

enableSessionReplayBool / Boolean

Enable session replay (video + logs + network capture).

Default: true

enableFlowsBool / Boolean

Enable dynamic flow composition and remote sync.

Default: true

captureNetworkBool / Boolean

Capture network requests including URL, method, status code, and timing.

Default: true

captureConsoleLogsBool / Boolean

Capture console / log output (print and os_log on iOS, Logcat on Android).

Default: true

Device Transport

Since 1.0.0 the SDK talks to the backend over MQTT (an EMQX broker) instead of a WebSocket. The protocol does the work the old channel hand-rolled: broker keepalive replaces the heartbeat, a persistent QoS 1 session queues messages while a device is offline and delivers them on reconnect, and a retained flags topic means a freshly connected device gets its current flag state without asking.

You normally do not configure any of this — the defaults connect over TLS to your backend's host. The options exist for local development and as a rollback path.

transportRemoteTransportKind

Device channel. Set to .websocket / WEBSOCKET to fall back to the legacy WebSocket path.

Default: .mqtt / MQTT

mqttHostString? / String?

Broker hostname. Defaults to the host from baseUrl, which is correct for a standard deployment.

Default: nil (backend host)

mqttPortInt / Int

Broker port. 8883 is MQTT over TLS; use 1883 only against a local plaintext broker.

Default: 8883

mqttUseTLSBool / Boolean

TLS for the broker connection. The device API key travels as the MQTT password, so only disable this against a local dev broker.

Default: true

Pointing at a local broker

swift
PipeKit.configure(
apiKey: "pk_live_...",
baseUrl: "http://192.168.1.10:8080",
config: PipeKitConfig(
mqttHost: "192.168.1.10",
mqttPort: 1883,
mqttUseTLS: false // local broker only
)
)

Falling back to WebSocket

The WebSocket path is still supported and hits the same endpoints. Switch to it if you need to rule the broker out while debugging.

swift
PipeKit.configure(
apiKey: "pk_live_...",
config: PipeKitConfig(transport: .websocket)
)

Kill Switch

Every app has an enable/disable toggle in the dashboard under Apps. Disabling one is the safe way to stop a release that is misbehaving without shipping an update or revoking an API key.

The SDK picks it up on its next sync and stops doing work: no session recording, no execution polling, no node or flag reporting, and any cached flows are dropped so a disabled app cannot keep running what it synced earlier. A recording already in progress is stopped.

It stays reversible. The SDK keeps syncing while disabled — that is the only channel that can lift the switch. Re-enable the app and devices resume on their next sync.

Sessions already recorded still upload. They were captured while the app was enabled, and disabling stops new work rather than discarding data already on the device.

Reacting to it in your app

swift
if PipeKit.isKillSwitchActive {
// The app is disabled from the dashboard. Recording and remote
// execution are already stopped — this is only if you want to
// reflect it in your own UI or telemetry.
}

Uploading Sessions

Sessions are captured locally and can be uploaded to the server. Inspect saved sessions and trigger an upload manually:

Upload.swift
// List sessions captured on the device
let sessions = PipeKit.getSavedSessions()
// Upload a specific session
PipeKit.uploadSession(sessionId: "session_id") { result in
switch result {
case .success(let response):
print("Uploaded: \(response.sessionId)")
case .failure(let error):
print("Failed: \(error)")
}
}

SwiftUI Configuration

For SwiftUI apps, initialize in your App struct:

YourApp.swift
import SwiftUI
import PipeKit
@main
struct YourApp: App {
init() {
PipeKit.configure(apiKey: "pk_live_your_api_key")
PipeKit.startSession()
}
var body: some Scene {
WindowGroup {
ContentView()
.trackScreen("Home")
}
}
}

Environment-based Configuration

Use different settings for development and production:

Environment.swift
#if DEBUG
let apiKey = "pk_test_development_key"
#else
let apiKey = "pk_live_production_key"
#endif
PipeKit.configure(apiKey: apiKey)

Tip: Use separate API keys

Create separate API keys for development and production in your dashboard. This keeps test sessions separate from real user data.

Next: Recording Sessions

Learn how to manually start/stop recording and control session behavior.

Continue to Recording →