# Interface ActorInstance<S, CP, CS, V, I, DB>

interface ActorInstance<S, CP, CS, V, I, DB extends AnyDatabaseProvider> {
actorContext: ActorContext<S, CP, CS, V, I, DB>;
connectionManager: ConnectionManager<S, CP, CS, V, I, DB>;
driver: ActorDriver;
eventManager: EventManager<S, CP, CS, V, I, DB>;
get abortSignal(): AbortSignal;
get actions(): string[];
get config(): ActorConfig<S, CP, CS, V, I, DB>;
get conns(): Map<string, Conn<S, CP, CS, V, I, DB>>;
get connStateEnabled(): boolean;
get db(): InferDatabaseClient<DB>;
get id(): string;
get inlineClient(): Client<Registry<any>>;
get inspector(): ActorInspector;
get inspectorToken(): string | undefined;
get isStopping(): boolean;
get key(): string[];
get log(): Logger;
get name(): string;
get persist(): PersistedActor<S, CP, CS, I>;
get region(): string;
get rLog(): Logger;
get schedule(): Schedule;
get state(): S;
set state(value: S): void;
get stateEnabled(): boolean;
get vars(): V;
assertReady(allowStoppingState?: boolean): void;
beginHonoHttpRequest(): void;
endHonoHttpRequest(): void;
executeAction(
ctx: ActionContext<S, CP, CS, V, I, DB>,
actionName: string,
args: unknown[],
): Promise<unknown>;
handleRawRequest(
conn: Conn<S, CP, CS, V, I, DB>,
request: Request,
): Promise<Response>;
handleRawWebSocket(
conn: Conn<S, CP, CS, V, I, DB>,
websocket: UniversalWebSocket,
request?: Request,
): void;
isReady(): boolean;
onAlarm(): Promise<void>;
onStop(): Promise<void>;
processMessage(
message: {
body:
| {
tag: "ActionRequest";
val: { args: unknown; id: bigint; name: string };
}
| {
tag: "SubscriptionRequest";
val: { eventName: string; subscribe: boolean };
};
},
conn: Conn<S, CP, CS, V, I, DB>,
): Promise<void>;
resetSleepTimer(): void;
saveState(opts: SaveStateOptions): Promise<void>;
scheduleEvent(
timestamp: number,
action: string,
args: unknown[],
): Promise<void>;
start(
actorDriver: ActorDriver,
inlineClient: Client<Registry<any>>,
actorId: string,
name: string,
key: string[],
region: string,
): Promise<void>;
startSleep(): void;
waitUntil(promise: Promise<void>): void;
}

#### Type Parameters

- S
- CP
- CS
- V
- I
- DB extends AnyDatabaseProvider

- Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:73

##### Index

### Properties

actorContext
connectionManager
driver
eventManager

### Accessors

abortSignal
actions
config
conns
connStateEnabled
db
id
inlineClient
inspector
inspectorToken
isStopping
key
log
name
persist
region
rLog
schedule
state
stateEnabled
vars

### Methods

assertReady
beginHonoHttpRequest
endHonoHttpRequest
executeAction
handleRawRequest
handleRawWebSocket
isReady
onAlarm
onStop
processMessage
resetSleepTimer
saveState
scheduleEvent
start
startSleep
waitUntil

## Properties

### actorContext

actorContext: ActorContext<S, CP, CS, V, I, DB>

- Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:75

### connectionManager

connectionManager: ConnectionManager<S, CP, CS, V, I, DB>

- Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:85

### driver

driver: ActorDriver

- Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:77

### eventManager

eventManager: EventManager<S, CP, CS, V, I, DB>

- Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:89

## Accessors

### abortSignal

- get abortSignal(): AbortSignal

  #### Returns AbortSignal

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:249

### actions

- get actions(): string[]

  #### Returns string[]

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:253

### config

- get config(): ActorConfig<S, CP, CS, V, I, DB>

  #### Returns ActorConfig<S, CP, CS, V, I, DB>

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:257

### conns

- get conns(): Map<string, Conn<S, CP, CS, V, I, DB>>

  #### Returns Map<string, Conn<S, CP, CS, V, I, DB>>

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:241

### connStateEnabled

- get connStateEnabled(): boolean

  #### Returns boolean

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:278

### db

- get db(): InferDatabaseClient<DB>

  #### Returns InferDatabaseClient<DB>

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:289

### id

- get id(): string

  #### Returns string

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:213

### inlineClient

- get inlineClient(): Client<Registry<any>>

  #### Returns Client<Registry<any>>

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:229

### inspector

- get inspector(): ActorInspector

  #### Returns ActorInspector

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:233

### inspectorToken

- get inspectorToken(): string | undefined

  #### Returns string | undefined

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:237

### isStopping

- get isStopping(): boolean

  #### Returns boolean

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:209

### key

- get key(): string[]

  #### Returns string[]

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:221

### log

- get log(): Logger

  #### Returns Logger

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:199

### name

- get name(): string

  #### Returns string

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:217

### persist

- get persist(): PersistedActor<S, CP, CS, I>

  #### Returns PersistedActor<S, CP, CS, I>

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:262

### region

- get region(): string

  #### Returns string

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:225

### rLog

- get rLog(): Logger

  #### Returns Logger

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:204

### schedule

- get schedule(): Schedule

  #### Returns Schedule

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:245

### state

- get state(): S

  #### Returns S

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:266
- set state(value: S): void

  #### Parameters

  - value: S

  #### Returns void

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:270

### stateEnabled

- get stateEnabled(): boolean

  #### Returns boolean

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:274

### vars

- get vars(): V

  #### Returns V

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:283

## Methods

### assertReady

- assertReady(allowStoppingState?: boolean): void

  #### Parameters

  - allowStoppingState: boolean = false

  #### Returns void

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:365

### beginHonoHttpRequest

- beginHonoHttpRequest(): void

  #### Returns void

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:440

### endHonoHttpRequest

- endHonoHttpRequest(): void

  #### Returns void

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:445

### executeAction

- executeAction(
  ctx: ActionContext<S, CP, CS, V, I, DB>,
  actionName: string,
  args: unknown[],
  ): Promise<unknown>

  #### Parameters

  - ctx: ActionContext<S, CP, CS, V, I, DB>
  - actionName: string
  - args: unknown[]

  #### Returns Promise<unknown>

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:519

### handleRawRequest

- handleRawRequest(
  conn: Conn<S, CP, CS, V, I, DB>,
  request: Request,
  ): Promise<Response>

  #### Parameters

  - conn: Conn<S, CP, CS, V, I, DB>
  - request: Request

  #### Returns Promise<Response>

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:603

### handleRawWebSocket

- handleRawWebSocket(
  conn: Conn<S, CP, CS, V, I, DB>,
  websocket: UniversalWebSocket,
  request?: Request,
  ): void

  #### Parameters

  - conn: Conn<S, CP, CS, V, I, DB>
  - websocket: UniversalWebSocket
  - `Optional` request: Request

  #### Returns void

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:631

### isReady

- isReady(): boolean

  #### Returns boolean

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:361

### onAlarm

- onAlarm(): Promise<void>

  #### Returns Promise<void>

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:680

### onStop

- onStop(): Promise<void>

  #### Returns Promise<void>

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:372

### processMessage

- processMessage(
  message: {
  body:
  | {
  tag: "ActionRequest";
  val: { args: unknown; id: bigint; name: string };
  }
  | {
  tag: "SubscriptionRequest";
  val: { eventName: string; subscribe: boolean };
  };
  },
  conn: Conn<S, CP, CS, V, I, DB>,
  ): Promise<void>

  #### Parameters

  - message: {
    body:
    | {
    tag: "ActionRequest";
    val: { args: unknown; id: bigint; name: string };
    }
    | {
    tag: "SubscriptionRequest";
    val: { eventName: string; subscribe: boolean };
    };
    }
  - conn: Conn<S, CP, CS, V, I, DB>

  #### Returns Promise<void>

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:475

### resetSleepTimer

- resetSleepTimer(): void

  #### Returns void

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:944

### saveState

- saveState(opts: SaveStateOptions): Promise<void>

  #### Parameters

  - opts: SaveStateOptions

  #### Returns Promise<void>

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:458

### scheduleEvent

- scheduleEvent(timestamp: number, action: string, args: unknown[]): Promise<void>

  #### Parameters

  - timestamp: number
  - action: string
  - args: unknown[]

  #### Returns Promise<void>

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:672

### start

- start(
  actorDriver: ActorDriver,
  inlineClient: Client<Registry<any>>,
  actorId: string,
  name: string,
  key: string[],
  region: string,
  ): Promise<void>

  #### Parameters

  - actorDriver: ActorDriver
  - inlineClient: Client<Registry<any>>
  - actorId: string
  - name: string
  - key: string[]
  - region: string

  #### Returns Promise<void>

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:297

### startSleep

- startSleep(): void

  #### Returns void

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:412

### waitUntil

- waitUntil(promise: Promise<void>): void

  #### Parameters

  - promise: Promise<void>

  #### Returns void

  - Defined in rivetkit-typescript/packages/rivetkit/src/actor/instance/mod.ts:686