MENU
    connect
    • 12 Nov 2020
    • 1 Minute to read
    • Contributors
    • Dark
    • PDF

    connect

    • Dark
    • PDF

    Article summary

    Description

    Connects to the avatar associated with the specified identity.


    Input Parameters

    NameTypeRequiredDescription
    identityObjectYesIdentity associated with target avatar
    [simOnly]BooleanNoWhether or not to connect when in simulation mode only; Default = false

    Returns

    Type: Avatar (Json object)

    If connection is successful, an avatar Json object is returned. Otherwise, null is returned.


    Examples

    // connect to a Dr. Know patient using an MRN identity
    var identity = {
        "mrn": "12345"
    };
    
    // connect to avatar
    avatar.connect(identity);
    JavaScript
    // alternatively, connect to avatar only when in simulation mode
    // note: useful for testing when an avatar is not connected
    avatar.connect(identity, true);
    JavaScript

    Remarks

    When working with avatars, you must first connect to the avatar with an identity that has already been attached to the avatar. When successful, you can call subsequent functions on that avatar.

    When your app runs in production, the avatar object is already connected to the associated patient. This means you already have access to this avatar (via the avatar object) and can skip this connection step.

    During development in the App Simulator, your app is not attached to an avatar by default. In order to test avatar features, you will need to first connect to an avatar with a patient MRN identity (see example above).

    In addition to the runtime avatar object, you can also connect to additional (including external) avatars using other identities in both development and production environments. Interact with these avatars using your own assigned variables.

    Definition

    Avatars and identities are special Symmetry concepts. An avatar represents any person, place, or thing. An identity is used to identify and connect to an avatar. Learn more at The Symmetry Project.


    What's Next