Skip to main content

Class: RoomManager

Pushes messages into the ODIN rooms of a project's live sessions.

Requires the rooms.push scope (API keys) and a session whose bot is in the room. Limits: 8 KB per encoded frame, 20 messages per second per room.

Constructors​

new RoomManager()​

new RoomManager(ctx, projectId): RoomManager

Internal

Parameters​

ParameterType
ctxClientContext
projectIdstring

Returns​

RoomManager

Defined in​

odin-transcription-service/packages/cortex-typescript-sdk/src/resources/rooms.ts:26

Methods​

send()​

send(sessionId, message): Promise<object>

Send one message into the room of a session.

Clients receive it through ODIN's MessageReceived from the bot peer, as a frame { type, id, seq, data } behind the bytes 0x43 0x58 0x01.

Parameters​

ParameterTypeDescription
sessionIdstringThe live session whose room to send into
messageobjecttype (not starting with cortex.), data and optional targetExternalUserIds
message.dataobjectDescription Frame payload, delivered to the clients as data. Any JSON object. The whole encoded frame must not exceed 8 KB; larger messages are rejected with 413. Example { * "secondsLeft": 10 * }
message.targetExternalUserIds?string[]Description Deliver only to the peers of these players (your own user ids, as used in their ODIN tokens). Omit to send to everyone in the room. Players who are not in the room are skipped. At most 64. Example [ "steam:76561198000000000" ]
message.typestringDescription Frame type the clients switch on. 1–64 characters: letters, digits and ._:-, starting with a letter or digit. Types starting with cortex. are reserved for frames Cortex emits itself. Example match.countdown

Returns​

Promise<object>

The frame id the clients will see, and the encoded size

NameTypeDescriptionDefined in
acceptedAtstringDescription When Cortex accepted the message (ISO 8601)odin-transcription-service/packages/cortex-typescript-sdk/src/types.ts:5614
idstringDescription Frame id — the clients receive it as the frame id Example 7d0c4c2e-3f7b-4d0a-9f7e-1c2b3a4d5e6fodin-transcription-service/packages/cortex-typescript-sdk/src/types.ts:5600
sessionIdstringDescription Session whose room the message was sent intoodin-transcription-service/packages/cortex-typescript-sdk/src/types.ts:5602
sizeBytesnumberDescription Encoded frame size in bytes (header included) Example 64odin-transcription-service/packages/cortex-typescript-sdk/src/types.ts:5612
typestringDescription The frame type Example match.countdownodin-transcription-service/packages/cortex-typescript-sdk/src/types.ts:5607

Throws​

CortexApiError 409 when no bot is in the room, 413 when the frame exceeds 8 KB, CortexRateLimitError when the room exceeded its budget

Example​

await ctx.cortex.rooms.send(sessionId, {
type: "match.countdown",
data: { secondsLeft: 10 },
});

Defined in​

odin-transcription-service/packages/cortex-typescript-sdk/src/resources/rooms.ts:51