Skip to main content
This release is a pre-release — the latest non-prerelease version of @rivet-gg/actor-client is 24.6.1. Jump to this version

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

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
64%
Published
2 days ago (24.6.2-rc.2)
class ActorHandleRaw

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

Constructors

new
ActorHandleRaw(
endpoint: string,
parameters: unknown,
protocolFormat: ProtocolFormat,
)

Do not call this directly.

Creates an instance of ActorHandleRaw.

Methods

connect(): void

Do not call this directly.

Establishes a WebSocket connection to the server using the specified endpoint and protocol format.

Disconnects the WebSocket connection.

Disposes of the ActorHandleRaw instance by disconnecting the WebSocket connection.

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

Subscribes to an event that will happen repeatedly.

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

Subscribes to an event that will be triggered only once.

rpc<
Args extends Array<unknown> = unknown[],
Response = unknown,
>
(
name: string,
...args: Args,
): Promise<Response>

Call a raw RPC handle. See ActorHandle for type-safe RPC calls.

See

Add Package

deno add jsr:@rivet-gg/actor-client

Import symbol

import { ActorHandleRaw } from "@rivet-gg/actor-client";

---- OR ----

Import directly with a jsr specifier

import { ActorHandleRaw } from "jsr:@rivet-gg/actor-client";

Add Package

npx jsr add @rivet-gg/actor-client

Import symbol

import { ActorHandleRaw } from "@rivet-gg/actor-client";

Add Package

yarn dlx jsr add @rivet-gg/actor-client

Import symbol

import { ActorHandleRaw } from "@rivet-gg/actor-client";

Add Package

pnpm dlx jsr add @rivet-gg/actor-client

Import symbol

import { ActorHandleRaw } from "@rivet-gg/actor-client";

Add Package

bunx jsr add @rivet-gg/actor-client

Import symbol

import { ActorHandleRaw } from "@rivet-gg/actor-client";