/** * Enum indicating when an {@link RSCommandAcknowledgement} should be * sent in response to an {@link RSCommand}. * @public */ export declare enum AcknowledgeOn { /** Send a response as soon as the RSCommand message is received. */ Received = 0, /** Send a response once the RSCommand has finished processing. */ Finished = 1, } /** * Default values for {@link RSNotification.category}. * @public */ export declare enum Category { Default = 0, Chat = 1, Log = 2, } /** * Default implementation of {@link ILogger}. Calls * console.log at the appropriate logging level. * @public */ export declare class ConsoleLogger implements ILogger { trace(msg: string, ...data: any[]): void; debug(msg: string, ...data: any[]): void; error(msg: string, ...data: any[]): void; info(msg: string, ...data: any[]): void; warn(msg: string, ...data: any[]): void; } /** * Create a new remote support logger with overridable methods * @public */ export declare function createRemoteSupportLogger(): ILogger; /** * Decodes an {@link RSTaggedData} object to a boolean value. If the data does not contain * a boolean value, the function returns null * @param data - message containing a boolean value * @public */ export declare function decodeBoolean(data: RSTaggedData): boolean | null; /** * Decodes an {@link RSTaggedData} object to a 64-bit float. If the data does not contain * a 64-bit float, the function returns null * @param data - message containing a 64-bit float * @public */ export declare function decodeDouble(data: RSTaggedData): number | null; /** * Decodes an {@link RSTaggedData} object to a 32-bit float. If the data does not contain * a 32-bit float, the function returns null * @param data - message containing a 32-bit float * @public */ export declare function decodeFloat(data: RSTaggedData): number | null; /** * Decodes an {@link RSTaggedData} object to a 32-bit int. If the data does not contain * a 32-bit int, the function returns null * @param data - message containing a 32-bit int * @public */ export declare function decodeInt(data: RSTaggedData): number | null; /** * Decodes an {@link RSTaggedData} object to a JS object. If the data does not contain * a UTF-8 encoded JSON payload, the function returns null * @param data - message containing a UTF-8 encoded serialized JSON object * @public */ export declare function decodeJson(data: RSTaggedData): T | null; /** * Decodes an {@link RSTaggedData} object to a 64-bit int. If the data does not contain * a 64-bit int, the function returns null * @param data - message containing a 64-bit int * @public */ export declare function decodeLong(data: RSTaggedData): bigint | null; /** * Decodes an {@link RSTaggedData} object to a JS object. If the data does not contain * a UTF-8 encoded JSON payload with the provided tag, the function returns null * @param tag - the expected tag * @param data - message containing a UTF-8 encoded serialized JSON object * @public */ export declare function decodeObject(tag: string, data: RSTaggedData): T | null; /** * Decodes an {@link RSTaggedData} object to text. If the data does not contain * a UTF-8 string, the function returns null * @param data - message containing a UTF-8 encoded string * @public */ export declare function decodeString(data: RSTaggedData): string | null; /** * Default {@link RSNotification.category} values. * @public */ export declare const DefaultCategory: { /** Numeric category for chat messages */ Chat: Category; /** Numeric category for byte arrays */ Bytes: Category; /** Numeric category for log messages */ Log: Category; /** Numeric category for JSON messages */ Object: Category; }; /** * Default mimetype tags for {@link RSTaggedData.tag}. * @public */ export declare const DefaultTag: { Chat: string; Bytes: string; Log: string; Object: string; }; /** * Provides a mechanism for releasing resources * @public */ declare interface Disposable_2 { /** * Performs application-defined tasks associated with freeing, releasing, or resetting resources. */ dispose(): void; } export { Disposable_2 as Disposable }; /** @public */ export declare type DisposableObject = | Disposable_2 | { close(): void; } | { destroy(): void; } | { unsubscribe(): void; }; /** * Utility class to track disposable resources. All tracked resources are disposed * in the order they are added to the scope when the dispose() method is called * @public */ export declare class DisposeScope implements Disposable_2 { private disposed; get isDisposed(): boolean; private resources; /** * Add a disposable resource to the disposal scope * @param resource - Disposable resource * @returns The disposable resource */ add(resource: T): T; /** * Add any number of disposable resources to the disposal scope * @param resource - Disposable resources */ addRange(...resource: T[]): void; /** * Throw an exception if the scope has been disposed * @param objectName - Class name to use in error */ checkDisposed(objectName: string): void; /** {@inheritdoc Disposable.dispose} */ dispose(): void; } /** * Type alias for a function to be called when an {@link IEvent} triggers. * * @param T - the type of object emitted by the handled event * @public */ export declare type EventHandler = (data: T) => void | Promise; /** * Implementation of {@link ILogger}. Calls another ILogger, filtering out * messages below a given severity level. * @public */ export declare class FilteredLogger implements ILogger { private logger; private level; /** * Construct a FilteredLogger. * * @param logger - A {@link ILogger} to invoke when messages above a certain severity level are logged. * @param level - The minimum severity level to log. */ constructor(logger: ILogger, level: LogLevel); trace(msg: string, ...data: any[]): void; debug(msg: string, ...data: any[]): void; error(msg: string, ...data: any[]): void; info(msg: string, ...data: any[]): void; warn(msg: string, ...data: any[]): void; } /** * Provides the ability to wait for an async task to complete * @public */ export declare interface IAsyncReceipt { wait(): Promise; } /** * Provides the ability to acknowledge a command * @public */ export declare interface ICommandContext { /** * ID of the associated command */ commandId: string; /** * If an acknowledgement has not been sent, acknowledge() sends an * acknowledgemetn */ acknowledge(): Promise; /** * If an acknowledgement has not been sent, error() responds to the command * with an error * @param code - Error code * @param message - Error message */ error(code: number, message: string): Promise; } /** * Contains the command and context object used to interact with the command * @public */ export declare interface ICommandEventArgs { /** Command sent from peer */ command: RSCommand; /** Context containing response actions */ context: ICommandContext; } /** * Provides the ability to wait for a response from a command * @public */ export declare interface ICommandReceipt extends IAsyncReceipt {} /** * @public */ export declare interface IEvent { /** * Subscribe an {@link EventHandler} to this event. The handler will be called with the * object emitted by this event whenever it is triggered. * * @param handler - the handler to subscribe to this event */ subscribe(handler: EventHandler): Disposable_2; } /** * An IEventDispatcher is responsible for triggering a given {@link IEvent}. * @public */ export declare interface IEventDispatcher, T = void> extends Disposable_2 { /** * The {@link IEvent} to trigger. */ event: U; /** * Raise the {@link IEvent} * * @param data - the data to pass to the event's subscribers. */ dispatch(data: T): Promise; /** * Clear all event handlers */ clear(): void; } /** * ILogger is an interface for publishing log messages at varying * levels of severity. * @public */ export declare interface ILogger { /** * Log a message at `trace` level. * * @remarks * trace is the least severe of logging. * * @param msg - The message to log at trace level. * @param data - Additional JSON-encodable data relevant to the message. */ trace(msg: string, ...data: any[]): void; /** * Log a message at `debug` level. * * @param msg - The message to log at debug level. * @param data - Additional JSON-encodable data relevant to the message. */ debug(msg: string, ...data: any[]): void; /** * Log a message at `info` level. * * @param msg - The message to log at info level. * @param data - Additional JSON-encodable data relevant to the message. */ info(msg: string, ...data: any[]): void; /** * Log a message at `warn` level. * * @param msg - The message to log at warn level. * @param data - Additional JSON-encodable data relevant to the message. */ warn(msg: string, ...data: any[]): void; /** * Log a message at `error` level. * * @remarks * trace is the most severe level of logging. * * @param msg - The message to log at error level. * @param data - Additional JSON-encodable data relevant to the message. */ error(msg: string, ...data: any[]): void; } /** * Imessage inspection event args * @public */ export declare interface IMessageInspectionEventArgs { /** * Message data */ Data: Uint8Array; /** * Message type */ MessageType: 'Notification' | 'Command' | 'CommandAcknowledgement' | 'Query' | 'QueryResponse' | 'Unknown'; } /** * Provides the ability to respond to a query * @public */ export declare interface IQueryContext { /** * The ID of the associated query */ queryId: string; /** * Sends an error response * @param code - Error code * @param message - Error message */ error(code: number, message: string): Promise; /** * Sends a query repsonse * @param data - response data to send * @param isFinal - true if not provided */ respond(data: RSTaggedData, isFinal?: boolean): Promise; } /** * Contains the query and context object used to interact with the query request * @public */ export declare interface IQueryEventArgs { /** Context containing response actions */ context: IQueryContext; /** Query sent from peer */ query: RSQuery; } /** * Provides the ability to wait for a reponse from a query. If you expect to * receive multiple responses, handle the onResponse event to handle each * response as it is received. Only the last response is returned by the wait() * promose. * @public */ export declare interface IQueryReceipt extends IAsyncReceipt { readonly onResponse: IEvent; } /** * Determines if a message contains binary data * @param data - message * @returns true if the message contains binary data * @public */ export declare function isBinary(data: RSTaggedData): boolean; /** * Determines if a message contains a boolean value * @param data - message * @returns true if the message contains a boolean value * @public */ export declare function isBoolean(data: RSTaggedData): boolean; /** * Determines if a message contains a 64-bit float * @param data - message * @returns true if the message contains a 64-bit float * @public */ export declare function isDouble(data: RSTaggedData): boolean; /** * Determines if a message is empty * @param data - message * @returns true if the message is empty * @public */ export declare function isEmpty(data: RSTaggedData): boolean; /** * Determines if a message contains a 32-bit float * @param data - message * @returns true if the message contains a 32-bit float * @public */ export declare function isFloat(data: RSTaggedData): boolean; /** * Determines if a message contains a 32-bit int * @param data - message * @returns true if the message contains a 32-bit int * @public */ export declare function isInt(data: RSTaggedData): boolean; /** * Determines if a message contains json data * @param data - message * @returns true if the message contains json data * @public */ export declare function isJson(data: RSTaggedData): boolean; /** * Determines if a message contains a 64-bit int * @param data - message * @returns true if the message contains a 64-bit int * @public */ export declare function isLong(data: RSTaggedData): boolean; /** * Determines if a message contains text data * @param data - message * @returns true if the message contains text data * @public */ export declare function isText(data: RSTaggedData): boolean; /** * Enum for logging severity levels * @public */ export declare enum LogLevel { ERROR = 'ERROR', WARN = 'WARN', INFO = 'INFO', DEBUG = 'DEBUG', TRACE = 'TRACE', } /** * Contains information about a partially received message that has expired from * the receive cache * @public */ export declare class MesageExpiredEventArgs { readonly messageId: number; readonly chunks: number[]; /** * Creates an instance of mesage expired event args. * @param messageId - Data transport message id * @param chunks - List of message part ids that are needed to reassemble the * message */ constructor(messageId: number, chunks: number[]); } /** * Thrown when an error occurs during message processing * @public */ export declare class MessageError extends Error { readonly code: number; constructor(code: number, msg?: string); } /** * Message error event args * @public */ export declare class MessageErrorEventArgs { messageId: number; category: number; error: string; /** * Creates an instance of message error event args. * @param messageId - Data transport message id * @param category - User defined category * @param error - Error message */ constructor(messageId: number, category: number, error: string); } /** * Message header information * @public */ export declare class MessageHeader { readonly msgid: number; readonly category: number; readonly messageType: MessageType; readonly position: number; readonly length: number; /** * Create a new message header * @param msgid - Message ID * @param category - user defined message category * @param position - chunk id / chunk index * @param length - number of chunks required to transmit the complete message */ constructor(msgid: number, category: number, messageType: MessageType, position: number, length: number); } /** * A message received by the underlying data transport * @public */ export declare class MessageReceivedEventArgs { readonly msgid: number; readonly data: Uint8Array; /** * @param msgid - ID used to reassemble this message from chunks * @param data - Message data */ constructor(msgid: number, data: Uint8Array); } /** * Information about a multipart message that has been partially received by the * data transport * @public */ export declare class MessageStartReceiveEventArgs { readonly messageId: number; readonly category: number; /** * Creates an instance of event args. * @param messageId - Data transport message id * @param category - user specified query */ constructor(messageId: number, category: number); } /** * Data transport message type * @public */ export declare type MessageType = 'message' | 'message_chunk' | 'ack' | 'retry' | 'failed' | 'unknown'; /** * MulticastEventDispatcher is the default implementation {@link IEventDispatcher}. MulticastEventDispatcher supports multiple subscribers. When an event is raised, each subscriber is called in the order that they registered * @public */ export declare class MulticastEventDispatcher implements IEventDispatcher, T> { /** * Construct an EventDispatcher. */ constructor(); /** {@inheritdoc Disposable.dispose} */ dispose(): void; clear(): void; /** {@inheritdoc IEventDispatcher.event} */ get event(): IEvent; /** {@inheritdoc IEventDispatcher.dispatch} */ dispatch(data: T): Promise; } /** * Creates a new {@link RSTaggedData} object with the data encoded as a boolean value * @param data - the data to encode * @public */ export declare function newBooleanData(data: boolean): RSTaggedData; /** * Creates a new {@link RSCommand} object * @param category - numeric category * @param data - command data * @param ack - when to send acknowledgement * @public */ export declare function newCommand(category: number, data: RSTaggedData, ack: AcknowledgeOn): RSCommand; /** * Creates a new {@link RSTaggedData} object with the data encoded as a 64-bit float * @param data - the data to encode * @public */ export declare function newDoubleData(data: number): RSTaggedData; /** * Creates a new {@link RSTaggedData} object with an empty payload * @public */ export declare function newEmptyData(): RSTaggedData; /** * Creates a new {@link RSTaggedData} object with the data encoded as a 32-bit float * @param data - the data to encode * @public */ export declare function newFloatData(data: number): RSTaggedData; /** * Creates a new {@link RSTaggedData} object with the data encoded as a 32-bit int * @param data - the data to encode * @public */ export declare function newIntData(data: number): RSTaggedData; /** * Creates a new {@link RSTaggedData} object with the message object serialized to JSON and encoded as UTF-8 * @param message - the message to encode * @public */ export declare function newJsonData(message: any): RSTaggedData; /** * Creates a new {@link RSTaggedData} object with the data encoded as a 64-bit int * @param data - the data to encode * @public */ export declare function newLongData(data: bigint): RSTaggedData; /** * Creates a new {@link RSNotification} object * @param category - numeric category * @param data - notification data * @public */ export declare function newNotification(category: number, data: RSTaggedData): RSNotification; /** * Creates a new {@link RSTaggedData} object with the message serialized to JSON and encoded as UTF-8 * @param tag - the message tag * @param message - the message to encode * @public */ export declare function newObjectData(tag: string, message: any): RSTaggedData; /** * Creates a new {@link RSQuery} object * @param category - numeric category * @param data - query data * @public */ export declare function newQuery(category: number, data: RSTaggedData): RSQuery; /** * Creates a new {@link RSTaggedData} object with the message string encoded as UTF-8 text * @param message - the message to encode * @public */ export declare function newStringData(message: string): RSTaggedData; /** * Creates a new {@link RSTaggedData} object with the message string encoded as UTF-8 text * @param tag - the message tag * @param message - the message to encode * @public */ export declare function newStringEncodedData(tag: string, message: string): RSTaggedData; /** * Creates a new {@link RSTaggedData} object with the given tag and Uint8Array * @param tag - Tag * @param data - Data * @public */ export declare function newTaggedData(tag: string, data: Uint8Array): RSTaggedData; /** * Thrown when a method is called after an object has been closed or when a promise * is rejected because the object that created the promise was closed * @public */ export declare class ObjectClosedError extends Error { constructor(className: string); } /** * Information about a multipart message that has been partially received by the * data transport * @public */ export declare class PartialMessageReceivedEventArgs extends MessageHeader { readonly received: number; /** * Creates an instance of partial message received event args. * @param header - Message part header * @param received - Number of chunks received */ constructor(header: MessageHeader, received: number); } /** * Create a new RemoteSupportClient * @param apiUrlBase - Reach API URL * @param apiKey - Cygnus Reach api key * @param logger - Framework logger. Default logger writes to the browser console * @param retainLogs - Upload logs to the server. Defaults to true * @returns initialized RemoteSupportClient * @public */ export declare function remoteSupport( apiUrlBase: string, apiKey: string, logger?: ILogger, retainLogs?: boolean, ): 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. * @public */ export declare class RemoteSupportClient { /** * Event raised when the first chunk of a multi-part message is received */ get onPartialMessage(): IEvent; /** * Event raised when a message error occurs */ get onMessageError(): IEvent; /** * The event that is invoked when an outgoing message has been encoded, but * before it is sent */ get onInspectOutgoingMesage(): IEvent; /** * the event that is invoked when an incoming message has been received, but * before it is decoded */ get onInspectIncomingMessage(): IEvent; /** * The event that is triggered when both sides of the * peer connection have connected. */ get onConnect(): IEvent; /** * The event that is triggered when the other side * of the peer connection disconnects unexpectedly. */ get onDisconnect(): IEvent; /** * The event that is triggered when the other side * of the peer connection intentionally closes the connection. */ get onExpectedDisconnect(): IEvent; /** * The event that is triggered when the other side * of the peer connection sends an {@link RSNotification} message. */ get onNotification(): IEvent; /** * Called when an {@link RSQuery} is received. */ get onQuery(): IEvent; /** * Called when an {@link RSQuery} is received. */ get onCommand(): IEvent; /** * Called when a video stream is added to the current session */ get onVideoStreamAdded(): IEvent; private commandClients; private commandCategories; private connectionInformation?; /** * Construct a RemoteSupportClient. * * @param apiUrlBase - The base URL of the Remote Support API. * @param apiKey - A key for authenticating API access. * @param timeout - The timeout for the WebRTC client to begin reconnect. * @param logger - The logger instance for this session. * @param retainLogs - Whether to export logs from this session to permanent * storage. * * @throws If a required parameter is null. */ constructor(apiUrlBase: string, apiKey: string, timeout: number, logger?: ILogger, retainLogs?: boolean); /** * 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. */ getSessionID(): string; /** * @returns true if the client is connected */ get isConnected(): boolean; /** * Connect the client to an existing support session. * * @param pin - the PIN of the remote support session * @throws If called when a remote support session is already initialized, or * if * the remote support session fails to initialize. */ connectToSupportSession(pin: string): Promise; /** * Initiate a new support session. * * @returns the PIN of the created remote support session * @throws If the data channel wrapper fails to initialize. */ initiateSupportSession(newSession?: boolean): Promise; private initWebRTCClient; replaceVideoTrack(track: MediaStreamTrack | null): Promise; replaceScreenTrack(track: MediaStreamTrack | null): Promise; addVideoStream(stream: MediaStream): Promise; addScreenStream(stream: MediaStream): Promise; /** * Send an {@link RSNotification} to the other side of the peer connection. * * @param notification - The notification to send * * @throws If called before remote support session is initialized. */ sendNotification(notification: RSNotification): Promise; /** * Send an {@link RSCommand} to the other side of the peer connection. * * @param command - the command to send * @returns a receipt used to wait for the command to be acknowledged * @throws If the command has an invalid {@link AcknowledgeOn}, or if called * before remote support session is * initialized. */ sendCommand(command: RSCommand, clientID?: string): Promise; /** * Send an {@link RSQuery} to the other side of the peer connection. * * @param query - an {@link RSQuery}. * * @throws If called before remote support session is initialized. */ sendQuery(query: RSQuery): Promise; /** * Send an {@link 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` * * @param data - the ArrayBuffer to send. * * @throws If called before remote support session is initialized. */ sendBytes(data: ArrayBuffer, tag?: string, category?: number): Promise; /** * Set the category number and mimetype for an {@link RSNotification} * containing raw bytes. * * @param category - the category number for raw bytes. * @param tag - the mimetype for raw bytes. */ setDefaultBytesCategoryAndTag(category: number, tag: string): void; /** * Send an {@link 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` * * @param data - the object to JSON-encode and send */ sendObject(data: any, tag?: string, category?: number): Promise; /** * Set the category number and mimetype for an {@link RSNotification} * containing JSON data. * * @param category - the category number for JSON data. */ setDefaultObjectCategory(category: number): void; /** * Send an {@link 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. * * @param text - The text data to send. * @param tag - The mimetype of the message to send. * @param category - The numeric category of the message to send. * * @throws If called before remote support session is initialized. */ sendChat(text: string, tag?: string, category?: number): Promise; /** * Send an {@link 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` * * @param text - The log message to send. * @param tag - The mimetype of the message to send. * @param category - The numeric category of the message to send. * * @throws If called before remote support session is initialized. */ sendLogMessage(text: string, tag?: string, category?: number): Promise; /** * Set the category number and mimetype for an {@link RSNotification} * containing a log message. * * @param category - the category number for log messages. * @param tag - the mimetype for log messages. */ setDefaultLogCategoryAndTag(category: number, tag: string): void; /** * Send a text message to a specified number. * * @param message - The message to send. * @param number - The E. 164 number to send the message to. */ sendSMS(message: string, number: string): Promise; /** * Send an email to a recipient with the provided body and subject. * * @param message - The message placed in the body of the email to be sent. * @param subject - The subject line of the email to be sent. * @param recipient - The email address that will recieve the message. */ sendEmail(message: string, subject: string, recipient: string): Promise; /** * Close the peer connection. * * @param sendDisconnect - 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 */ disconnect(sendDisconnect?: boolean): Promise; /** * Clean up all resources associated with this object including event * handlers, buffers, and network clients */ close(): void; } /** @public */ export declare class RemoteSupportVideoTrack { readonly stream: MediaStream; readonly kind: VideoStreamType; readonly track: MediaStreamTrack; readonly receiver: RTCRtpReceiver; readonly tranceiver: RTCRtpTransceiver; constructor(event: RTCTrackEvent); private getKind; } /** * An RSCommand is a request from one side of the peer connection that * some action be performed by the other side of the peer connection. * @public */ export declare class RSCommand { /** Message ID */ msgid: number; /** * Enum value indicating when the other side of the connection should send an * acknowledgement of the received command. */ acknowledgeOn: AcknowledgeOn; /** A number representing the type of the message. */ category: number; /** * A piece of data containing information about the command to be executed. */ data: RSTaggedData; /** * Construct an RSCommand. * * @param msgid - Data transport message id * @param category - A number representing the type of the message. * @param data - An {@link RSTaggedData} containing information about the * command * to be executed. * @param acknowledgedOn - Enum value indicating when the other side of the * connection should send an acknowledgement of the * received command. * * @throws If a required parameter is null. */ constructor( msgid: number | undefined, category: number | undefined, data: RSTaggedData, acknowledgedOn: AcknowledgeOn, ); /** * Construct an RSCommand. * * @param category - A number representing the type of the message. * @param data - An {@link RSTaggedData} containing information about the * command * to be executed. * @param acknowledgedOn - Enum value indicating when the other side of the * connection should send an acknowledgement of the * received command. * * @throws If a required parameter is null. */ static create(category: number | undefined, data: RSTaggedData, acknowledgedOn: AcknowledgeOn): RSCommand; } /** * An RSCommandAcknowledgement is a message that indicates that * an {@link RSCommand} from the other side of the connection * has been processed. * @public */ export declare class RSCommandAcknowledgement { /** * The DataChannelMessage ID of the command being acknowledged. */ acknowledging: string; /** * Construct an RSCommandAcknowledgement. * * @param acknowledging - The DataChannelMessage ID of the command * being acknowledged. */ constructor(acknowledging: string); } /** * Enum representing the type of the message * @public */ export declare enum RSCommandCategory { NEW_PEER = 10, } /** * Command error * @public */ export declare class RSCommandError extends RSCommandAcknowledgement { /** * Error message */ error: string; /** * User defined error code */ errorcode: number; /** * Creates an instance of rscommand error. * @param acknowledging - The original command id * @param code - User defined error code * @param error - Error message */ constructor(acknowledging: string, code: number, error: string); } /** * An RSNotification is a message containing general information * that does not require a response from the other side of the * peer connection. * @public */ export declare class RSNotification { /** Message Id */ msgid: number; /** A number representing the type of the message. */ category: number; /** Some unstructured data. */ data: RSTaggedData; /** * Construct a RSNotification. * * @param msgid - data transport message id * @param category - A number representing the type of the data. * @param data - A piece of unstructured data. * @throws If `data` is null. */ constructor(msgid: number | undefined, category: number | undefined, data: RSTaggedData); /** * Construct a RSNotification. * * @param category - A number representing the type of the data. * @param data - A piece of unstructured data. * @throws If `data` is null. */ static create(category: number | undefined, data: RSTaggedData): RSNotification; } /** * An RSQuery is a request from one side of the peer connection for * some piece of data known by the other side of the peer connection. * @public */ export declare class RSQuery { /** Message ID */ msgid: number; /** A number representing the type of the message. */ category: number; /** A piece of data containing information about the query to be evaluated. */ data: RSTaggedData; /** * Construct an RSQuery. * * @param msgid - Data transport message id * @param category - A number representing the type of the message. * @param data - An {@link RSTaggedData} containing information about the * query to be evaluated. * * @throws If a required parameter is null. */ constructor(msgid: number | undefined, category: number | undefined, data: RSTaggedData); /** * Construct an RSQuery. * * @param category - A number representing the type of the message. * @param data - An {@link RSTaggedData} containing information about the * query to be evaluated. * * @throws If a required parameter is null. */ static create(category: number | undefined, data: RSTaggedData): RSQuery; } /** * An RSQueryError is a message containing the response to an * {@link RSQuery} sent by the other side of the connection. * @public */ export declare class RSQueryError { /** * The response to the query. */ error: string; /** * The error code */ errorCode: number; /** * The DataChannelMessage ID of the query being responded to. */ respondingTo: string; /** * * @param respondingTo - The DataChannelMessage ID of the query being * responded to. * @param errorCode - A code corresponding to an error * @param error - Error message */ constructor(respondingTo: string, errorCode: number, error: string); } /** * An RSQueryResponse is a message containing the response to an * {@link RSQuery} sent by the other side of the connection. * @public */ export declare class RSQueryResponse { /** Message ID */ msgid: number; /** * The response to the query. */ data: RSTaggedData; /** * Is this the final message in a series of messages */ isFinal: boolean; /** * The DataChannelMessage ID of the query being responded to. */ respondingTo: string; /** * @param msgid - The ID used to reassemble message chunks * @param respondingTo - The DataChannelMessage ID of the query being * responded to. * @param data - The response to the query. * @param isFinal - Indicates that this is the final response in a series */ constructor(msgid: number, respondingTo: string, data: RSTaggedData, isFinal?: boolean); } /** * RSTaggedData represents a piece of byte-encoded data with a mimetype. * @public */ export declare class RSTaggedData { /** Arbitrary byte-encoded data. */ data: Uint8Array; /** The mimetype associated with a piece of data. */ tag: string; /** * Construct an RSTaggedData * @param tag - The mimetype for the data. * @param data - Arbitrary byte-encoded data. * * @throws If either required parameter is null. */ constructor(tag: string, data: Uint8Array); } /** * UnicastEventDispatcher is the default implementation {@link IEventDispatcher}. UnicastEventDispatcher supports a single subscriber. When an event is raised, the most recent subscriber is called * @public */ export declare class UnicastEventDispatcher implements IEventDispatcher, T> { /** * Construct an EventDispatcher. */ constructor(allowSubscriptionUpdate?: boolean, eventName?: string); /** {@inheritdoc Disposable.dispose} */ dispose(): void; clear(): void; /** {@inheritdoc IEventDispatcher.event} */ get event(): IEvent; /** {@inheritdoc IEventDispatcher.dispatch} */ dispatch(data: T): Promise; } /** * Execute a function with a disposable resource and clean up after the function scope ends. * @param resource - Disposable resource * @param body - function to execute with resource * @returns Result of function * @public */ export declare function using(resource: T, body: (resource: T) => U): U; /** * Execute a function with a disposable resource and clean up after the function scope ends. * @param resource - Disposable resource * @param body - function to execute with resource * @returns Result of function * @public */ export declare function usingAsync( resource: T, body: (resource: T) => Promise, ): Promise; /** * Execute a function with a DisposeScope and clean up after the function scope ends. * @param body - function to execute with resource * @returns Result of function * @public */ export declare function usingScope(body: (scope: DisposeScope) => T): T; /** * Execute a function with a DisposeScope and clean up after the function scope ends. * @param body - function to execute with resource * @returns Result of function * @public */ export declare function usingScopeAsync(body: (scope: DisposeScope) => Promise): Promise; /** * Configuration for video stream * @public */ export declare class VideoStreamConfiguration { readonly MinWidth: number; readonly MaxWidth: number; readonly MinHeight: number; readonly MaxHeight: number; readonly MinFrameRate: number; readonly MaxFrameRate: number; constructor( MinWidth?: number, MaxWidth?: number, MinHeight?: number, MaxHeight?: number, MinFrameRate?: number, MaxFrameRate?: number, ); } /** @public */ export declare type VideoStreamType = 'camera' | 'screen' | 'unknown'; /** * Enum for which side of the WebRTC connection a peer will assume. * @public */ export declare enum WebRtcClientRole { /** * The Offer side of the peer connection generates the Offer session * description object, and opens the data channel upon recieving an * answer. */ Offer = 'offer', /** * The Answer side of the peer connection awaits an Offer session * description object from the other peer, then generates an answer. */ Answer = 'answer', } /** @public */ export declare enum WellKnownTags { /** Mimetype for a log message, default `text/plain; charset=utf-8` */ Text = 'text/plain; charset=utf-8', /** Mimetype for a byte array, default `application/octet-stream` */ Bytes = 'application/octet-stream', /** Mimetype for a JSON-encoded object, default `application/json` */ Json = 'application/json', /** Mimetype for a vendor specific int */ Int = 'application/vnd.cygnus+int32', /** Mimetype for a vendor specific long */ Long = 'application/vnd.cygnus+int64', /** Mimetype for a vendor specific float */ Float = 'application/vnd.cygnus+float32', /** Mimetype for a vendor specific double */ Double = 'application/vnd.cygnus+float64', /** Mimetype for a vendor specific boolean */ Boolean = 'application/vnd.cygnus+bool', /** Empty */ Empty = '', } export {};