Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Uhlive

Hierarchy

  • Uhlive

Index

Constructors

Events Methods

Other Methods

Constructors

constructor

  • Create an Uhlive instance by passing your private token and identifier.

    example
    const uhlive = new Uhlive("my-identifier", "my-token", {
      timeout: 3,
      url: "wss://api.uh.live",
    });

    Parameters

    • identifier: string
    • token: string
    • Optional options: UhliveOptions

    Returns Uhlive

Events Methods

onClose

  • onClose(callback: () => void): Uhlive
  • Subscribe to Uhlive onClose event.

    example
    const uhlive = new Uhlive("my-identifier", "my-token");
    uhlive.onClose(() => {
      // Choose what to do when the connection is closed.
    });

    Parameters

    • callback: () => void
        • (): void
        • Returns void

    Returns Uhlive

onError

  • onError(callback: () => void): Uhlive
  • Subscribe to Uhlive onError event.

    example
    const uhlive = new Uhlive("my-identifier", "my-token");
    uhlive.onError(() => {
      // Choose what to do when we encounter an error.
    });

    Parameters

    • callback: () => void
        • (): void
        • Returns void

    Returns Uhlive

Other Methods

connect

  • Connect to the websocket.

    example
    const uhlive = new Uhlive("my-identifier", "my-token");
    uhlive.connect();

    Returns Uhlive

disconnect

  • Disconnect from the websocket.

    example
    const uhlive = new Uhlive("my-identifier", "my-token");
    uhlive.connect();
    uhlive.join("my-conversation");
    uhlive.disconnect();

    Returns Uhlive

join

  • Join a conversation and start recording immediately.

    example
    const uhlive = new Uhlive("my-identifier", "my-token");
    uhlive.connect();
    uhlive.join("my-conversation", {
      speaker: "john",
    });
    uhlive.disconnect();
    example
    const uhlive = new Uhlive("my-identifier", "my-token");
    uhlive.connect();
    uhlive.join("my-conversation", {
      ignoreEntities: ["NumberFound"],
      readonly: true,
      wrapper: "my-custom-wrapper",
    });
    uhlive.disconnect();

    Parameters

    • conversationId: string
    • Default value options: ConversationOptions = {country: this.getCountryFromBrowser(),ignoreDecodingEvents: [],ignoreEntities: [],interim_results: true,model: this.getLocaleFromBrowser(),origin: 0,readonly: false,rescoring: true,speaker: Uhlive.generateSpeakerId(),wrapper: "uhlive",}

    Returns Conversation

leave

  • leave(conversationId: string): Uhlive
  • Leave a conversation.

    example
    const uhlive = new Uhlive("my-identifier", "my-token");
    uhlive.connect();
    uhlive.join("my-conversation");
    uhlive.leave("my-conversation");
    uhlive.disconnect();

    Parameters

    • conversationId: string

    Returns Uhlive

leaveAllConversations

  • leaveAllConversations(): Uhlive
  • Leave all conversations at once.

    example
    const uhlive = new Uhlive("my-identifier", "my-token");
    uhlive.connect();
    uhlive.join("my-conversation1");
    uhlive.join("my-conversation2");
    uhlive.leaveAllConversations();
    uhlive.disconnect();

    Returns Uhlive