SDK Functions
Here's a list of all the functions supported by the UserView iOS SDK.
Connection Management
| Function | Description |
|---|---|
connect() | Establishes a WebSocket connection to the servers. |
disconnect() | Closes the connection temporarily without ending the session. |
reset() | Resets the connection state and reconnects if previously connected. |
Session Control
| Function | Description |
|---|---|
stopSession() | Ends the current screen sharing session. |
customMessage(message: String) | Sends a custom text or JSON message to the agent. |
Visitor Information
| Function | Returns | Description |
|---|---|---|
getShortId() | String | Returns the visitor's unique short ID. |
getLookupCode() | String | Returns or generates a 4-digit lookup code (expires after 1 hour). |
getWatchLink() | URL? | Returns the full URL where agents can view the session. |
Updating Connection Properties
Use updateConnection() to update visitor identification after initialization:
upscopeManager.updateConnection(
agentPrompt: .set("VIP Customer"),
integrationIds: .set(["zendesk:12345"]),
identities: .set(["John Smith", "john@example.com"]),
uniqueId: .set("user-123"),
metadata: ["plan": "enterprise", "region": "US"]
)
StringOption Values
When updating string values, use these options:
.set("value")- Sets the value.remove- Removes the valuenil- Keeps the existing value unchanged
StringArrayOption Values
When updating array values, use these options:
.set(["value1", "value2"])- Sets the array.remove- Removes all valuesnil- Keeps the existing values unchanged
State Subscriptions
Subscribe to real-time state changes:
// Connection status
upscopeManager.subscribeToIsConnected { isConnected in
print("Connected: \(isConnected)")
}
// Screen capture active
upscopeManager.subscribeToIsRecording { isRecording in
print("Recording: \(isRecording)")
}
// Short ID changes
upscopeManager.subscribeToShortId { shortId in
print("Short ID: \(shortId ?? "none")")
}
// Lookup code changes
upscopeManager.subscribeToLookupCode { code in
print("Lookup code: \(code ?? "none")")
}
// Connection ID changes
upscopeManager.subscribeToUniqueConnectionId { connectionId in
print("Connection ID: \(connectionId ?? "none")")
}
Redaction Control
| Property/Function | Description |
|---|---|
redactionEnabled | Boolean to enable/disable redaction globally. |
registerFlutterRedactionCallback() | Registers an async callback for Flutter redaction support. |
Logging
| Property | Description |
|---|---|
enableLogging | Set to true to enable debug logging. |
enableTelemetry | Set to true to enable telemetry data collection. |
