RemoteSupportClient

public class RemoteSupportClient : NSObject

Used to define the peer to peer connection and communicate over it

  • True when data channel is open and communication is ready

    Declaration

    Swift

    public var isConnected: Bool { get }
  • Client provided logger

    Declaration

    Swift

    public var logger: Logger? { get set }
  • Event fired when the WebRTC data channel of a connection is first opened

    Declaration

    Swift

    public let onConnect: AnyPublisher<Void, Never>
  • Event fired when the WebRTC data channel is no longer available

    Declaration

    Swift

    public let onDisconnect: AnyPublisher<DisconnectEventArgs, Never>
  • Event fired when RemoteSupportClient fails to receive a valid message that connected peer tried to send

    Declaration

    Swift

    public let onMessageError: AnyPublisher<MessageErrorEventArgs, Never>
  • Event fired when RemoteSupportClient receives partial message chunks for an incomplete large message

    Declaration

    Swift

    public let onPartialMessage: AnyPublisher<PartialMessageReceivedEventArgs, Never>
  • Event fired when there is an incoming notification

    Declaration

    Swift

    public let onNotification: AnyPublisher<NotificationEventArgs, Never>
  • Event fired when there is an incoming command

    Warning

    If this method is not implemented and the RemoteSupportClient receives a command, it will respond with a not implemented error by default

    Note

    Sending an error response is only supported if the command’s acknowledgeOn is set to finished. Otherwise, the acknowledgement is sent when the command is received

    Declaration

    Swift

    public let onCommand: AnyPublisher<CommandEventArgs, Never>
  • Event fired when there is an incoming query

    Warning

    If this method is not implemented and the RemoteSupportClient receives a query, it will respond with a not implemented error by default

    Declaration

    Swift

    public let onQuery: AnyPublisher<QueryEventArgs, Never>
  • Event fired when a video share stream begins

    Declaration

    Swift

    public let onVideoCapture: AnyPublisher<VideoCaptureEventArgs, Never>
  • Event fired when a screen share stream begins

    Declaration

    Swift

    public let onScreenCapture: AnyPublisher<ScreenCaptureEventArgs, Never>
  • Event fired when a video share stream begins

    Declaration

    Swift

    public let onVideoCaptureFailed: AnyPublisher<Error, Never>
  • Event fired when a screen share stream begins

    Declaration

    Swift

    public let onScreenCaptureFailed: AnyPublisher<Error, Never>
  • Initializes a RemoteSupportClient with a base URL string and API key

    Declaration

    Swift

    public init(apiUrlBase: String, apiKey: String, retainLogs: Bool, timeout: Int = 5, logger: Logger? = nil)

    Parameters

    apiUrlBase

    Base URL of the Remote Support API

    apiKey

    Key for authenticating API access

    retainLogs

    Whether to export logs from this session to permanent storage

    timeout

    The timeout (in seconds) for the WebRTC client to begin reconnect. Currently unused

    logger

    The Logger instance for this session

    delegate

    RemoteSupportDelegate that receives remote support state change callbacks and events

    dispatchQueue

    The DispatchQueue that delegate events are fired on. Defaults to the main queue

  • Initiates the connection process. Use for generating a PIN that will then be handed to a separate client

    Declaration

    Swift

    public func initiateSupportSession() -> Promise<String>
  • Connects to a support session that some other client has initiated

    Declaration

    Swift

    public func connectToSupportSession(pin: String) -> Promise<Void>

    Parameters

    pin

    The PIN string that the other client has generated

  • Disconnects current connection, optionally sends a disconnect to peer and resets all state

    Declaration

    Swift

    @discardableResult
    public func disconnect(sendDisconnect: Bool = true) -> Promise<Void>

    Parameters

    sendDisconnect

    Only set to false if we received a disconnect signal from peer

Setting default tags and categories

Data sending

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

    Declaration

    Swift

    public func sendNotification(notification: RSNotification) -> Promise<Void>
  • Send a command to the other side of the peer connection and get back a command acknowledgement or error response

    Declaration

    Swift

    public func sendCommand(command: RSCommand, timeout: TimeInterval = 30) -> Promise<Void>

    Parameters

    command

    The RSCommand to be sent

    timeout

    The time in seconds that this command will timeout at without receiving a response. Defaults to 30 seconds

  • Send a query to the other side of the peer connection and get back a data response or error response

    Declaration

    Swift

    public func sendQuery(query: RSQuery, timeout: Double = 30, onReceived: (@escaping (_ response: RSTaggedData, _ isLastMessage: Bool) -> Void) = { _, _ in }) -> RSQueryReceipt

    Parameters

    query

    The RSQuery to be sent

    timeout

    The time in seconds that this query will timeout at without receiving a response. Defaults to 30 seconds

  • Send binary data across the webRTC DataChannel

    Declaration

    Swift

    public func sendBytes(data: Data, tag: String = DefaultTag.Bytes, category: UInt16 = DefaultCategory.Bytes) -> Promise<Void>
  • Send a chat message across the webRTC DataChannel

    Declaration

    Swift

    public func sendChat(text: String, tag: String = DefaultTag.Chat, category: UInt16 = DefaultCategory.Chat) -> Promise<Void>
  • Send a log message across the webRTC DataChannel

    Declaration

    Swift

    public func sendLog(text: String, tag: String = DefaultTag.Log, category: UInt16 = DefaultCategory.Log) -> Promise<Void>
  • Send a JSON-encodable object across the webRTC DataChannel

    Declaration

    Swift

    public func sendEncodable<T>(of type: T.Type, encodable: T, tag: String = DefaultTag.Object, category: UInt16 = DefaultCategory.Object) -> Promise<Void> where T : Encodable

Video sharing