Interface: Room\<TPresence\>
@roomful/core / Room
Interface: Room<TPresence>
Section titled “Interface: Room<TPresence>”Defined in: packages/core/src/types.ts:1247
Exposes the public room API.
Type Parameters
Section titled “Type Parameters”TPresence
Section titled “TPresence”TPresence extends PresenceData = PresenceData
The custom peer presence shape.
Properties
Section titled “Properties”
readonlyid:string
Defined in: packages/core/src/types.ts:1251
Identifies the room.
peerCount
Section titled “peerCount”
readonlypeerCount:number
Defined in: packages/core/src/types.ts:1271
Reports the current peer count.
peerId
Section titled “peerId”
readonlypeerId:string
Defined in: packages/core/src/types.ts:1256
Identifies the local peer.
readonlypeers:Peer<TPresence>[]
Defined in: packages/core/src/types.ts:1266
Exposes the latest known peer list.
status
Section titled “status”
readonlystatus:RoomStatus
Defined in: packages/core/src/types.ts:1261
Reports the current room status.
Methods
Section titled “Methods”connect()
Section titled “connect()”connect():
Promise<void>
Defined in: packages/core/src/types.ts:1278
Connects the room to its transport.
Returns
Section titled “Returns”Promise<void>
A promise that resolves when connection startup completes.
disconnect()
Section titled “disconnect()”disconnect():
Promise<void>
Defined in: packages/core/src/types.ts:1285
Disconnects the room from its transport.
Returns
Section titled “Returns”Promise<void>
A promise that resolves when disconnect teardown completes.
getDiagnostics()
Section titled “getDiagnostics()”getDiagnostics():
Promise<RoomDiagnostics>
Defined in: packages/core/src/types.ts:1292
Produces a diagnostics snapshot for the room.
Returns
Section titled “Returns”Promise<RoomDiagnostics>
A promise that resolves to the current diagnostics snapshot.
getYDoc()
Section titled “getYDoc()”getYDoc():
Doc
Defined in: packages/core/src/types.ts:1341
Exposes the underlying Yjs document for CRDT integrations.
Returns
Section titled “Returns”Doc
The shared Yjs document.
getYProvider()
Section titled “getYProvider()”getYProvider():
RoomfulYjsProvider
Defined in: packages/core/src/types.ts:1348
Exposes the underlying Yjs provider for CRDT integrations.
Returns
Section titled “Returns”The Yjs provider.
off<
TEvent>(event,cb):void
Defined in: packages/core/src/types.ts:1371
Removes a built-in room lifecycle listener.
Type Parameters
Section titled “Type Parameters”TEvent
Section titled “TEvent”TEvent extends RoomEventName
The built-in event name being removed.
Parameters
Section titled “Parameters”TEvent
The event name to unsubscribe from.
RoomEventHandler<TPresence, TEvent>
The callback to remove.
Returns
Section titled “Returns”void
Nothing.
on<
TEvent>(event,cb):Unsubscribe
Defined in: packages/core/src/types.ts:1358
Subscribes to a built-in room lifecycle event.
Type Parameters
Section titled “Type Parameters”TEvent
Section titled “TEvent”TEvent extends RoomEventName
The built-in event name to subscribe to.
Parameters
Section titled “Parameters”TEvent
The event name to observe.
RoomEventHandler<TPresence, TEvent>
The callback invoked with the matching payload.
Returns
Section titled “Returns”A function that removes the listener.
useAwareness()
Section titled “useAwareness()”useAwareness():
AwarenessEngine
Defined in: packages/core/src/types.ts:1326
Accesses the awareness engine for this room.
Returns
Section titled “Returns”The awareness engine.
useCursors()
Section titled “useCursors()”useCursors<
TCursor>(options?):CursorEngine<TCursor>
Defined in: packages/core/src/types.ts:1308
Accesses the cursor engine for this room.
Type Parameters
Section titled “Type Parameters”TCursor
Section titled “TCursor”TCursor extends CursorData = CursorData
The custom cursor payload shape.
Parameters
Section titled “Parameters”options?
Section titled “options?”Optional cursor tracking configuration.
Returns
Section titled “Returns”CursorEngine<TCursor>
The cursor engine.
useEvents()
Section titled “useEvents()”useEvents(
options?):EventEngine<TPresence>
Defined in: packages/core/src/types.ts:1334
Accesses the custom event engine for this room.
Parameters
Section titled “Parameters”options?
Section titled “options?”Optional custom event behavior overrides.
Returns
Section titled “Returns”EventEngine<TPresence>
The event engine.
usePresence()
Section titled “usePresence()”usePresence():
PresenceEngine<TPresence>
Defined in: packages/core/src/types.ts:1299
Accesses the presence engine for this room.
Returns
Section titled “Returns”PresenceEngine<TPresence>
The presence engine.
useState()
Section titled “useState()”useState<
T>(options):StateEngine<T>
Defined in: packages/core/src/types.ts:1319
Accesses the shared-state engine for this room.
Type Parameters
Section titled “Type Parameters”T
The shared state value type.
Parameters
Section titled “Parameters”options
Section titled “options”StateOptions<T>
The shared-state configuration.
Returns
Section titled “Returns”StateEngine<T>
The state engine.