Skip to main content
Version: 0.10.x

Class: OdinClient

The Odin client is the main entry point for the Odin SDK. It is used to create rooms. Create an instance with your access key and use it to create rooms.

Constructors​

new OdinClient()​

new OdinClient(sampleRate?, channelCount?): OdinClient

Creates a new instance of a client. Use this to create rooms.

Parameters​

• sampleRate?: number

The sample rate of the audio stream (between 8000 and 48000) - default is 48000

• channelCount?: number

The number of channels of the audio stream (1 or 2) - default is 1

Returns​

OdinClient

Defined in​

odin.client.d.ts:13

Methods​

createRoom()​

createRoom(accessKey, roomId, userId): OdinRoom

Creates a new local room instance with the given ID and user ID. Use join to connect to that room.

Parameters​

• accessKey: string

The access key to use to generate the token. You can get a free access token in our developer center

• roomId: string

The ID of the room to create.

• userId: string

The ID of the user to create the room for.

Returns​

OdinRoom

Defined in​

odin.client.d.ts:39


createRoomWithAccessToken()​

createRoomWithAccessToken(accessToken): OdinRoom

Creates a new local room instance with the given access token. Use join on the returned OdinRoom instance to connect to that room. Use this method if you already have an access token, either created elsewhere or by calling generateToken. To be more consistent with other SDKs, this method is deprecated. Use createRoomWithToken instead.

Parameters​

• accessToken: string

The access token to use to join the room.

Returns​

OdinRoom

Deprecated​

Use createRoomWithToken instead

Defined in​

odin.client.d.ts:49


createRoomWithToken()​

createRoomWithToken(accessToken): OdinRoom

Creates a new local room instance with the given room token. Use join on the returned OdinRoom instance to connect to that room. Use this method if you already have an access token, either created elsewhere or by calling generateAccessToken.

Parameters​

• accessToken: string

The access token to use to join the room.

Returns​

OdinRoom

Defined in​

odin.client.d.ts:57


generateAccessToken()​

generateAccessToken(accessKey, roomId, userId): string

Generates a token for the given access key, room and user ID. This token can be used to join the room. To be more consistent with other SDKs, this method is deprecated. Use generateToken instead.

Parameters​

• accessKey: string

The access key to use to generate the token. You can get a free access token in our developer center

• roomId: string

The ID of the room to generate the token for.

• userId: string

The ID of the user to generate the token for.

Returns​

string

Deprecated​

Use generateToken instead

Defined in​

odin.client.d.ts:23


generateToken()​

generateToken(accessKey, roomId, userId): string

Generates a room token for the given access key, room and user ID. This token can be used to join the room.

Parameters​

• accessKey: string

The access key to use to generate the token. You can get a free access token in our developer center

• roomId: string

The ID of the room to generate the token for.

• userId: string

The ID of the user to generate the token for.

Returns​

string

Defined in​

odin.client.d.ts:31