Skip to content

beamable-sdk / core/BeamBase / BeamBase

Abstract Class: BeamBase

Defined in: src/core/BeamBase.ts:30

The base class for Beam SDK client and server instances.

Extended by

Properties

cid

cid: string

Defined in: src/core/BeamBase.ts:34

The Beamable Customer ID.


pid

pid: string

Defined in: src/core/BeamBase.ts:36

The Beamable Project ID.


requester

readonly requester: HttpRequester

Defined in: src/core/BeamBase.ts:32

The HTTP requester instance used by the Beam SDK.


tokenStorage

tokenStorage: TokenStorage

Defined in: src/core/BeamBase.ts:42

The token storage instance used by the client SDK. Defaults to BrowserTokenStorage in browser environments and NodeTokenStorage in Node.js environments. Can be overridden via the tokenStorage option in the BeamConfig.

Accessors

env

Get Signature

get static env(): BeamEnvVars

Defined in: src/core/BeamBase.ts:67

Environment variables that can be set to configure the Beam SDK.

Remarks

These values must be supplied at runtime via real environment variables (e.g. process.env.REALM_SECRET), and must not be committed directly into your source code.

Example
BeamBase.env.REALM_SECRET = process.env.REALM_SECRET;
const beam = await Beam.init({ ... });
Returns

BeamEnvVars

Methods

use()

Call Signature

abstract use<T>(ctors): this

Defined in: src/core/BeamBase.ts:86

Dynamically adds multiple api services or microservice clients to the Beam SDK.

Type Parameters
T

T extends ApiServiceCtor<any> | BeamMicroServiceClientCtor<any>

Parameters
ctors

readonly T[]

An array of constructors for the api service or microservice client.

Returns

this

The current instance of BeamBase.

Example

const beam = await Beam.init({ ... });
beam.use([LeadboardService, StatsService]);
or
const beam = await Beam.init({ ... });
beam.use([MyMicroserviceClient, MyOtherMicroserviceClient]);

Call Signature

abstract use<T>(ctor): this

Defined in: src/core/BeamBase.ts:105

Dynamically adds a single api service or microservice client to the Beam SDK.

Type Parameters
T

T extends ApiServiceCtor<any> | BeamMicroServiceClientCtor<any>

Parameters
ctor

T

The constructor for the api service or microservice client.

Returns

this

The current instance of BeamBase.

Example

const beam = await Beam.init({ ... });
beam.use(StatsService);
or
const beam = await Beam.init({ ... });
beam.use(MyMicroserviceClient);