Skip to content
Roomful is in public beta — install with the @beta tag. Share feedback →

Interface: Room\<TPresence\>

@roomful/core


@roomful/core / Room

Defined in: packages/core/src/types.ts:1247

Exposes the public room API.

TPresence extends PresenceData = PresenceData

The custom peer presence shape.

readonly id: string

Defined in: packages/core/src/types.ts:1251

Identifies the room.


readonly peerCount: number

Defined in: packages/core/src/types.ts:1271

Reports the current peer count.


readonly peerId: string

Defined in: packages/core/src/types.ts:1256

Identifies the local peer.


readonly peers: Peer<TPresence>[]

Defined in: packages/core/src/types.ts:1266

Exposes the latest known peer list.


readonly status: RoomStatus

Defined in: packages/core/src/types.ts:1261

Reports the current room status.

connect(): Promise<void>

Defined in: packages/core/src/types.ts:1278

Connects the room to its transport.

Promise<void>

A promise that resolves when connection startup completes.


disconnect(): Promise<void>

Defined in: packages/core/src/types.ts:1285

Disconnects the room from its transport.

Promise<void>

A promise that resolves when disconnect teardown completes.


getDiagnostics(): Promise<RoomDiagnostics>

Defined in: packages/core/src/types.ts:1292

Produces a diagnostics snapshot for the room.

Promise<RoomDiagnostics>

A promise that resolves to the current diagnostics snapshot.


getYDoc(): Doc

Defined in: packages/core/src/types.ts:1341

Exposes the underlying Yjs document for CRDT integrations.

Doc

The shared Yjs document.


getYProvider(): RoomfulYjsProvider

Defined in: packages/core/src/types.ts:1348

Exposes the underlying Yjs provider for CRDT integrations.

RoomfulYjsProvider

The Yjs provider.


off<TEvent>(event, cb): void

Defined in: packages/core/src/types.ts:1371

Removes a built-in room lifecycle listener.

TEvent extends RoomEventName

The built-in event name being removed.

TEvent

The event name to unsubscribe from.

RoomEventHandler<TPresence, TEvent>

The callback to remove.

void

Nothing.


on<TEvent>(event, cb): Unsubscribe

Defined in: packages/core/src/types.ts:1358

Subscribes to a built-in room lifecycle event.

TEvent extends RoomEventName

The built-in event name to subscribe to.

TEvent

The event name to observe.

RoomEventHandler<TPresence, TEvent>

The callback invoked with the matching payload.

Unsubscribe

A function that removes the listener.


useAwareness(): AwarenessEngine

Defined in: packages/core/src/types.ts:1326

Accesses the awareness engine for this room.

AwarenessEngine

The awareness engine.


useCursors<TCursor>(options?): CursorEngine<TCursor>

Defined in: packages/core/src/types.ts:1308

Accesses the cursor engine for this room.

TCursor extends CursorData = CursorData

The custom cursor payload shape.

CursorOptions

Optional cursor tracking configuration.

CursorEngine<TCursor>

The cursor engine.


useEvents(options?): EventEngine<TPresence>

Defined in: packages/core/src/types.ts:1334

Accesses the custom event engine for this room.

EventOptions

Optional custom event behavior overrides.

EventEngine<TPresence>

The event engine.


usePresence(): PresenceEngine<TPresence>

Defined in: packages/core/src/types.ts:1299

Accesses the presence engine for this room.

PresenceEngine<TPresence>

The presence engine.


useState<T>(options): StateEngine<T>

Defined in: packages/core/src/types.ts:1319

Accesses the shared-state engine for this room.

T

The shared state value type.

StateOptions<T>

The shared-state configuration.

StateEngine<T>

The state engine.