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;
    roomError?: ErrorInfo;
    roomStatus: RoomStatus;
    start: (() => Promise<void>);
    stop: (() => Promise<void>);
    typingIndicators?: Typing;
}

Hierarchy (view full)

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.

roomError?: ErrorInfo

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

roomStatus: RoomStatus

Provides the status of the room.

start: (() => Promise<void>)

A shortcut to the Typing.start method.

Type declaration

    • (): Promise<void>
    • Start indicates that the current user is typing. This will emit a typingStarted event to inform listening clients and begin a timer, once the timer expires, a typingStopped event will be emitted. The timeout is configurable through the typingTimeoutMs parameter. If the current user is already typing, it will reset the timer and being counting down again without emitting a new event.

      Returns Promise<void>

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

stop: (() => Promise<void>)

A shortcut to the Typing.stop method.

Type declaration

    • (): Promise<void>
    • Stop indicates that the current user has stopped typing. This will emit a typingStopped event to inform listening clients, and immediately clear the typing timeout timer.

      Returns Promise<void>

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

typingIndicators?: Typing

Provides access to the underlying Typing instance of the room.