Class RemoteSupportClient

A RemoteSupportClient is the primary point of interaction between a client application and remote support. It contains utilities for initiating a new remote support session and connecting to an existing one, building and handling messages that are exchanged between remote support peers, and responding to connection lifecycle events.

Hierarchy

  • RemoteSupportClient

Constructors

  • Construct a RemoteSupportClient.

    Throws

    If a required parameter is null.

    Parameters

    • apiUrlBase: string

      The base URL of the Remote Support API.

    • apiKey: string

      A key for authenticating API access.

    • timeout: number

      The timeout for the WebRTC client to begin reconnect.

    • logger: ILogger = ...

      The logger instance for this session.

    • retainLogs: boolean = true

      Whether to export logs from this session to permanent storage.

    Returns RemoteSupportClient

Accessors

  • get isConnected(): undefined | boolean
  • Returns

    true if the client is connected

    Returns undefined | boolean

  • get onConnect(): IEvent<void>
  • The event that is triggered when both sides of the peer connection have connected.

    Returns IEvent<void>

  • get onDisconnect(): IEvent<void>
  • The event that is triggered when the other side of the peer connection disconnects unexpectedly.

    Returns IEvent<void>

  • get onExpectedDisconnect(): IEvent<void>
  • The event that is triggered when the other side of the peer connection intentionally closes the connection.

    Returns IEvent<void>

Methods

  • Clean up all resources associated with this object including event handlers, buffers, and network clients

    Returns void

  • Connect the client to an existing support session.

    Throws

    If called when a remote support session is already initialized, or if the remote support session fails to initialize.

    Parameters

    • pin: string

      the PIN of the remote support session

    Returns Promise<void>

  • Close the peer connection.

    Parameters

    • sendDisconnect: boolean = true

      we don't want to send the disconnect message in the case of a connection reset or if we've received a disconnect from the other client

    Returns Promise<void>

  • The sessionID of the current session.

    Returns

    the sessionID of the current session.

    Throws

    If a sessionID has not yet been obtained from the Remote Support API.

    Returns string

  • Initiate a new support session.

    Returns

    the PIN of the created remote support session

    Throws

    If the data channel wrapper fails to initialize.

    Returns Promise<string>

  • Send an RSNotification containing a raw bytes to the other side of the peer connection.

    Remarks

    The data is sent as a Notification with category Bytes and tag application/octet-stream. * These defaults can be changed using setDefaultBytesCategoryAndTag

    Throws

    If called before remote support session is initialized.

    Parameters

    • data: ArrayBuffer

      the ArrayBuffer to send.

    • tag: string = DefaultTag.Bytes
    • category: number = DefaultCategory.Bytes

    Returns Promise<number>

  • Send an RSNotification containing a chat message to the other side of the peer connection.

    Remarks

    The data is sent as a Notification with category Chat and tag text/plain; charsets=utf-8. These defaults cannot be changed.

    Throws

    If called before remote support session is initialized.

    Parameters

    • text: string

      the text data to send.

    • tag: string = DefaultTag.Chat

      The mimetype of the message to send.

    • category: number = DefaultCategory.Chat

      The numeric category of the message to send.

    Returns Promise<number>

  • Send an RSCommand to the other side of the peer connection.

    Returns

    a receipt used to wait for the command to be acknowledged

    Throws

    If the command has an invalid AcknowledgeOn, or if called before remote support session is initialized.

    Parameters

    Returns Promise<ICommandReceipt>

  • Send an RSNotification containing a log message to the other side of the peer connection.

    Remarks

    The data is sent as a Notification with category Log and tag text/plain; charsets=utf-8. These defaults can be changed using setDefaultLogCategoryAndTag

    Throws

    If called before remote support session is initialized.

    Parameters

    • text: string

      The log message to send.

    • tag: string = DefaultTag.Log

      The mimetype of the message to send.

    • category: number = DefaultCategory.Log

      The numeric category of the message to send.

    Returns Promise<number>

  • Send an RSNotification to the other side of the peer connection.

    Throws

    If called before remote support session is initialized.

    Parameters

    Returns Promise<number>

  • Send an RSNotification containing a stringified JSON object to the other side of the peer connection.

    Remarks

    The data is sent as a Notification with category Object and tag application/json. * These defaults can be changed using setDefaultObjectCategory

    Parameters

    • data: any

      the object to JSON-encode and send

    • tag: string = DefaultTag.Object
    • category: number = DefaultCategory.Object

    Returns Promise<number>

  • Set the category number and mimetype for an RSNotification containing raw bytes.

    Parameters

    • category: number

      the category number for raw bytes.

    • tag: string

      the mimetype for raw bytes.

    Returns void

  • Set the category number and mimetype for an RSNotification containing a log message.

    Parameters

    • category: number

      the category number for log messages.

    • tag: string

      the mimetype for log messages.

    Returns void

  • Set the category number and mimetype for an RSNotification containing JSON data.

    Parameters

    • category: number

      the category number for JSON data.

    Returns void