# Class ActorConnRaw

Provides underlying functions for ActorConn. See ActorConn for using type-safe remote procedure calls.

#### See

ActorConn

- Defined in rivetkit-typescript/packages/rivetkit/src/client/actor-conn.ts:93

##### Index

### Constructors

constructor

### Methods

[CONNECT_SYMBOL]
action
dispose
on
once
onError

## Constructors

### constructor

- new ActorConnRaw(
  client: ClientRaw,
  driver: ManagerDriver,
  params: unknown,
  encoding: "json" | "cbor" | "bare",
  actorQuery:
  | { getForId: { actorId: string; name: string } }
  | { getForKey: { key: string[]; name: string } }
  | {
  getOrCreateForKey: {
  input?: unknown;
  key: string[];
  name: string;
  region?: string;
  };
  }
  | {
  create: {
  input?: unknown;
  key: string[];
  name: string;
  region?: string;
  };
  },
  ): ActorConnRaw
  `Protected`

  Do not call this directly.

  Creates an instance of ActorConnRaw.

  #### Parameters

  - client: ClientRaw
  - driver: ManagerDriver
  - params: unknown
  - encoding: "json" | "cbor" | "bare"
  - actorQuery:
    | { getForId: { actorId: string; name: string } }
    | { getForKey: { key: string[]; name: string } }
    | {
    getOrCreateForKey: {
    input?: unknown;
    key: string[];
    name: string;
    region?: string;
    };
    }
    | {
    create: {
    input?: unknown;
    key: string[];
    name: string;
    region?: string;
    };
    }

  #### Returns ActorConnRaw

  - Defined in rivetkit-typescript/packages/rivetkit/src/client/actor-conn.ts:151

## Methods

### `Protected`[CONNECT_SYMBOL]

- "[CONNECT_SYMBOL]"(): void
  `Protected`

  Do not call this directly. enc Establishes a connection to the server using the specified endpoint & encoding & driver.

  #### Returns void

  - Defined in rivetkit-typescript/packages/rivetkit/src/client/actor-conn.ts:230

### action

- action<Args extends unknown[] = unknown[], Response = unknown>(
  opts: { args: Args; name: string; signal?: AbortSignal },
  ): Promise<Response>

  Call a raw action connection. See ActorConn for type-safe action calls.

  #### Type Parameters

  - Args extends unknown[] = unknown[]

    The type of arguments to pass to the action function.

  - Response = unknown

    The type of the response returned by the action function.

  #### Parameters

  - opts: { args: Args; name: string; signal?: AbortSignal }

  #### Returns Promise<Response>

  - A promise that resolves to the response of the action function.

  #### See

  ActorConn

  - Defined in rivetkit-typescript/packages/rivetkit/src/client/actor-conn.ts:177

### dispose

- dispose(): Promise<void>

  Disconnects from the actor.

  #### Returns Promise<void>

  A promise that resolves when the socket is gracefully closed.

  - Defined in rivetkit-typescript/packages/rivetkit/src/client/actor-conn.ts:890

### on

- on<Args extends unknown[] = unknown[]>(
  eventName: string,
  callback: (...args: Args) => void,
  ): EventUnsubscribe

  Subscribes to an event that will happen repeatedly.

  #### Type Parameters

  - Args extends unknown[] = unknown[]

    The type of arguments the event callback will receive.

  #### Parameters

  - eventName: string

    The name of the event to subscribe to.

  - callback: (...args: Args) => void

    The callback function to execute when the event is triggered.

  #### Returns EventUnsubscribe

  - A function to unsubscribe from the event.

  #### See

  Documentation

  - Defined in rivetkit-typescript/packages/rivetkit/src/client/actor-conn.ts:646

### once

- once<Args extends unknown[] = unknown[]>(
  eventName: string,
  callback: (...args: Args) => void,
  ): EventUnsubscribe

  Subscribes to an event that will be triggered only once.

  #### Type Parameters

  - Args extends unknown[] = unknown[]

    The type of arguments the event callback will receive.

  #### Parameters

  - eventName: string

    The name of the event to subscribe to.

  - callback: (...args: Args) => void

    The callback function to execute when the event is triggered.

  #### Returns EventUnsubscribe

  - A function to unsubscribe from the event.

  #### See

  Documentation

  - Defined in rivetkit-typescript/packages/rivetkit/src/client/actor-conn.ts:662

### onError

- onError(callback: ActorErrorCallback): () => void

  Subscribes to connection errors.

  #### Parameters

  - callback: ActorErrorCallback

    The callback function to execute when a connection error occurs.

  #### Returns () => void

  - A function to unsubscribe from the error handler.
  - Defined in rivetkit-typescript/packages/rivetkit/src/client/actor-conn.ts:675