@ably/chat - v0.8.0
    Preparing search index...

    Interface UseTypingResponse

    Common status variables for chat features. Most hooks in this library implement this interface.

    interface UseTypingResponse {
        connectionError?: ErrorInfo;
        connectionStatus: ConnectionStatus;
        currentlyTyping: Set<string>;
        error?: ErrorInfo;
        keystroke: () => Promise<void>;
        roomError?: ErrorInfo;
        roomStatus: RoomStatus;
        stop: () => Promise<void>;
        typingIndicators?: Typing;
    }

    Hierarchy (View Summary)

    Index

    Properties

    connectionError?: ErrorInfo

    If there's a connection error it will be available here.

    connectionStatus: ConnectionStatus

    Provides the connection status of the Ably connection.

    currentlyTyping: Set<string>

    A state value representing the set of client IDs that are currently typing in the room. It automatically updates based on typing events received from the room.

    error?: ErrorInfo

    A state value representing the current error state of the hook, this will be an instance of Ably.ErrorInfo or undefined. An error can occur during mount when initially fetching the current typing state; this does not mean that further updates will not be received, and so the hook might recover from this state on its own.

    keystroke: () => Promise<void>

    A shortcut to the Typing.keystroke method.

    Type declaration

      • (): Promise<void>
      • This will send a typing.started event to the server. Events are throttled according to the heartbeatThrottleMs room option. If an event has been sent within the interval, this operation is no-op.

        Calls to keystroke() and stop() are serialized and will always resolve in the correct order.

        • For example, if multiple keystroke() calls are made in quick succession before the first keystroke() call has sent a typing.started event to the server, followed by one stop() call, the stop() call will execute as soon as the first keystroke() call completes. All intermediate keystroke() calls will be treated as no-ops.
        • The most recent operation (keystroke() or stop()) will always determine the final state, ensuring operations resolve to a consistent and correct state.

        Returns Promise<void>

        A promise which resolves upon success of the operation and rejects with an Ably.ErrorInfo object upon its failure.

        If the Connection is not in the Connected state.

        If the operation fails to send the event to the server.

        If there is a problem acquiring the mutex that controls serialization.

    roomError?: ErrorInfo

    If there's an error with the room it will be available here.

    roomStatus: RoomStatus

    Provides the status of the room.

    stop: () => Promise<void>

    A shortcut to the Typing.stop method.

    Type declaration

      • (): Promise<void>
      • This will send a typing.stopped event to the server. If the user was not currently typing, this operation is no-op.

        Calls to keystroke() and stop() are serialized and will always resolve in the correct order.

        • For example, if multiple keystroke() calls are made in quick succession before the first keystroke() call has sent a typing.started event to the server, followed by one stop() call, the stop() call will execute as soon as the first keystroke() call completes. All intermediate keystroke() calls will be treated as no-ops.
        • The most recent operation (keystroke() or stop()) will always determine the final state, ensuring operations resolve to a consistent and correct state.

        Returns Promise<void>

        A promise which resolves upon success of the operation and rejects with an Ably.ErrorInfo object upon its failure.

        If the Connection is not in the Connected state.

        If the operation fails to send the event to the server.

        If there is a problem acquiring the mutex that controls serialization.

    typingIndicators?: Typing

    Provides access to the underlying Typing instance of the room.