Documentation

    SDK Functions

    Here's a list of all the functions supported by the Co-Browsing API iOS SDK.

    Connection Management

    FunctionDescription
    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

    FunctionDescription
    stopSession()Ends the current screen sharing session.
    customMessage(message: String)Sends a custom text or JSON message to the agent.

    Visitor Information

    FunctionReturnsDescription
    getShortId()StringReturns the visitor's unique short ID.
    getLookupCode()StringReturns 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 value
    • nil - Keeps the existing value unchanged

    StringArrayOption Values

    When updating array values, use these options:

    • .set(["value1", "value2"]) - Sets the array
    • .remove - Removes all values
    • nil - 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/FunctionDescription
    redactionEnabledBoolean to enable/disable redaction globally.
    registerFlutterRedactionCallback()Registers an async callback for Flutter redaction support.

    Logging

    PropertyDescription
    enableLoggingSet to true to enable debug logging.
    enableTelemetrySet to true to enable telemetry data collection.