Documentation
    Preparing search index...

    Function createActorRouter

    • Creates a router that runs on the partitioned instance.

      Parameters

      • runConfig: {
            autoConfigureServerless?:
                | boolean
                | {
                    headers?: Record<string, string>;
                    maxRunners?: number;
                    metadata?: Record<string, unknown>;
                    minRunners?: number;
                    requestLifespan?: number;
                    runnersMargin?: number;
                    slotsPerRunner?: number;
                    url?: string;
                };
            basePath: string;
            defaultServerPort: number;
            disableActorDriver: boolean;
            disableDefaultServer: boolean;
            disableMetadataLookup: boolean;
            driver?: {
                actor: ActorDriverBuilder;
                manager: ManagerDriverBuilder;
                name: string;
            };
            encoding: "json"
            | "cbor"
            | "bare";
            endpoint?: string;
            getUpgradeWebSocket?: GetUpgradeWebSocket;
            headers: Record<string, string>;
            inspector: {
                defaultEndpoint?: string;
                enabled: boolean | { actor: boolean; manager: boolean };
                token: (...args: unknown[]) => string;
            };
            logging: {
                baseLogger?: Logger;
                level?: "error"
                | "trace"
                | "fatal"
                | "warn"
                | "info"
                | "debug"
                | "silent";
            };
            maxIncomingMessageSize: number;
            namespace: string;
            noWelcome: boolean;
            overrideServerAddress?: string;
            runEngine: boolean;
            runEngineVersion: string;
            runnerKey?: string;
            runnerKind: "serverless"
            | "normal";
            runnerName: string;
            token?: string;
            totalSlots: number;
        }
        • Optional ExperimentalautoConfigureServerless?:
              | boolean
              | {
                  headers?: Record<string, string>;
                  maxRunners?: number;
                  metadata?: Record<string, unknown>;
                  minRunners?: number;
                  requestLifespan?: number;
                  runnersMargin?: number;
                  slotsPerRunner?: number;
                  url?: string;
              }

          Automatically configure serverless runners in the engine. Can only be used when runnerKind is "serverless". If true, uses default configuration. Can also provide custom configuration.

        • ExperimentalbasePath: string

          Base path for the router. This is used to prefix all routes. For example, if the base path is /api, then the route /actors will be available at /api/actors.

        • ExperimentaldefaultServerPort: number
        • ExperimentaldisableActorDriver: boolean
        • ExperimentaldisableDefaultServer: boolean
        • disableMetadataLookup: boolean

          Whether to automatically perform health checks when the client is created.

        • Optionaldriver?: { actor: ActorDriverBuilder; manager: ManagerDriverBuilder; name: string }
          • actor: ActorDriverBuilder
          • manager: ManagerDriverBuilder
          • name: string

            Machine-readable name to identify this driver by.

        • encoding: "json" | "cbor" | "bare"
        • Optionalendpoint?: string

          Endpoint to connect to for Rivet Engine or RivetKit manager API.

        • OptionalgetUpgradeWebSocket?: GetUpgradeWebSocket
        • headers: Record<string, string>
        • Experimentalinspector: {
              defaultEndpoint?: string;
              enabled: boolean | { actor: boolean; manager: boolean };
              token: (...args: unknown[]) => string;
          }
          • OptionaldefaultEndpoint?: string

            Default RivetKit server endpoint for Rivet Inspector to connect to. This should be the same endpoint as what you use for your Rivet client to connect to RivetKit.

            This is a convenience property just for printing out the inspector URL.

          • enabled: boolean | { actor: boolean; manager: boolean }
          • token: (...args: unknown[]) => string

            Token used to access the Inspector.

        • Experimentallogging: {
              baseLogger?: Logger;
              level?: "error" | "trace" | "fatal" | "warn" | "info" | "debug" | "silent";
          }
        • ExperimentalmaxIncomingMessageSize: number
        • namespace: string

          Namespace to connect to.

        • ExperimentalnoWelcome: boolean

          Disable welcome message.

        • Optional ExperimentaloverrideServerAddress?: string
        • ExperimentalrunEngine: boolean
        • ExperimentalrunEngineVersion: string
        • OptionalrunnerKey?: string

          Unique key for this runner. Runners connecting a given key will replace any other runner connected with the same key.

        • ExperimentalrunnerKind: "serverless" | "normal"

          Whether to run runners normally or have them managed serverlessly (by the Rivet Engine for example).

        • runnerName: string

          Name of the runner. This is used to group together runners in to different pools.

        • Optionaltoken?: string

          Token to use to authenticate with the API.

        • totalSlots: number

          How many actors this runner can run.

      • actorDriver: ActorDriver
      • isTest: boolean

      Returns ActorRouter