Skip to main content
This package has been archived, and as such it is read-only.
This release is 1 version behind 24.6.2 — the latest version of @rivet-gg/actor. Jump to latest

🔩 Rivet Actors have built-in RPC, state, and events — the easiest way to build modern applications.

This package works with Deno
This package works with Deno
JSR Score
88%
Published
3 months ago (24.6.1-rc.2)
Package root>src>config.ts
export interface ActorConfig { protocol: { maxConnectionParametersSize: number; maxIncomingMessageSize: number; }; state: StateConfig; rpc: RpcConfig; } export interface StateConfig { saveInterval: number; } export interface RpcConfig { timeout: number; } export const DEFAULT_ACTOR_CONFIG: ActorConfig = { protocol: { // This goes in the URL so the default needs to be short maxConnectionParametersSize: 8_192, maxIncomingMessageSize: 65_536, }, state: { saveInterval: 1000, }, rpc: { timeout: 5000, }, }; export function mergeActorConfig( partialConfig?: Partial<ActorConfig>, ): ActorConfig { return { protocol: { maxConnectionParametersSize: partialConfig?.protocol?.maxConnectionParametersSize ?? DEFAULT_ACTOR_CONFIG.protocol.maxConnectionParametersSize, maxIncomingMessageSize: partialConfig?.protocol?.maxIncomingMessageSize ?? DEFAULT_ACTOR_CONFIG.protocol.maxIncomingMessageSize, }, state: { saveInterval: partialConfig?.state?.saveInterval ?? DEFAULT_ACTOR_CONFIG.state.saveInterval, }, rpc: { timeout: partialConfig?.rpc?.timeout ?? DEFAULT_ACTOR_CONFIG.rpc.timeout, }, }; }