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

    Interface Rooms

    Manages the lifecycle of chat rooms.

    interface Rooms {
        get clientOptions(): ChatClientOptions;
        get(name: string, options?: RoomOptions): Promise<Room>;
        release(name: string): Promise<void>;
    }
    Index

    Accessors

    Methods

    Accessors

    Methods

    • Gets a room reference by its unique identifier. The Rooms class ensures that only one reference exists for each room. A new reference object is created if it doesn't already exist, or if the one used previously was released using release(name).

      Always call release(name) after the Room object is no longer needed.

      If a call to get is made for a room that is currently being released, then the promise will resolve only when the release operation is complete.

      If a call to get is made, followed by a subsequent call to release before the promise resolves, then the promise will reject with an error.

      Parameters

      • name: string

        The unique identifier of the room.

      • Optionaloptions: RoomOptions

        The options for the room.

      Returns Promise<Room>

      Room A promise to a new or existing Room object.

      ErrorInfo if a room with the same name but different options already exists.

    • Release the Room object if it exists. This method only releases the reference to the Room object from the Rooms instance and detaches the room from Ably. It does not unsubscribe to any events.

      After calling this function, the room object is no-longer usable. If you wish to get the room object again, you must call Rooms.get.

      Calling this function will abort any in-progress get calls for the same room.

      Parameters

      • name: string

        The unique identifier of the room.

      Returns Promise<void>