Skip to content

Documentation / @super-line/server / Room

Interface: Room<C>

Defined in: index.ts:125

A mixed-role, server-controlled connection group. broadcast delivers a shared event to every member, regardless of their role.

Type Parameters

C

C extends Contract

Properties

connections

readonly connections: Conn<Record<string, ServerMessageDef>, unknown, string, unknown>[]

Defined in: index.ts:135

Snapshot of this room's members on the current node.


size

readonly size: number

Defined in: index.ts:133

Member count on the current node (membership is node-local).

Methods

add()

add(conn): void

Defined in: index.ts:127

Add a connection to the room (server-controlled membership).

Parameters

conn

Conn

Returns

void


broadcast()

broadcast<E>(event, data): void

Defined in: index.ts:131

Broadcast a shared event to all members.

Type Parameters

E

E extends string | number | symbol

Parameters

event

E

data

EmitData<EventsOf<StcOf<C["shared"]>>[E]>

Returns

void


remove()

remove(conn): void

Defined in: index.ts:129

Remove a connection from the room.

Parameters

conn

Conn

Returns

void

Released under the MIT License.