Skip to content

SDK API Reference / RealtimeSDK

Class: RealtimeSDK

RT 2.0 SDK

Methods

getConfig()

getConfig(parentSegmentId): Promise<RTConfig>

Get RT 2.0 configuration for a parent segment

Parameters

parentSegmentId

string

Parent segment ID

Returns

Promise<RTConfig>

RT configuration

Throws

When RT is not enabled or get operation fails

Example

typescript
const config = await realtime.getConfig('1069944');
console.log(config);

getStatus()

getStatus(parentSegmentId): Promise<RTStatus>

Get RT 2.0 status for a parent segment

Parameters

parentSegmentId

string

Parent segment ID

Returns

Promise<RTStatus>

RT status information

Throws

When the get operation fails

Example

typescript
const status = await realtime.getStatus('1069944');
console.log(status.realtime_enabled);

isEnabled()

isEnabled(parentSegmentId): Promise<boolean>

Check if RT 2.0 is enabled for a parent segment

Parameters

parentSegmentId

string

Parent segment ID

Returns

Promise<boolean>

True if RT is enabled, false otherwise


list()

list(): Promise<RTListItem[]>

List parent segments with their RT 2.0 status

Returns

Promise<RTListItem[]>

Array of parent segments with RT status

Throws

When the list operation fails

Example

typescript
const segments = await realtime.list();
console.log(segments.filter(s => s.realtime_enabled));

updateConfig()

updateConfig(parentSegmentId, config): Promise<RTConfig>

Update RT 2.0 configuration for a parent segment

Parameters

parentSegmentId

string

Parent segment ID

config

RTConfig

RT configuration

Returns

Promise<RTConfig>

Updated configuration

Throws

When the update operation fails

Example

typescript
const updated = await realtime.updateConfig('1069944', config);