Rivet Actors have built-in RPC, state, and events — the easiest way to build modern applications.
import { Client } from "@rivet-gg/actor-client"; import type Counter from "./counter.ts"; const client = new Client(/* CONNECTION ADDRESS */); // Get-or-create a counter actor const counter = await client.get<Counter>({ name: "counter" }); // Listen for update count events (https://rivet.gg/docs/events) counter.on("count", (count: number) => console.log("New count:", count)); // Increment the count over remote procedure call (https://rivet.gg/docs/rpc) await counter.increment(1); // Disconnect from the actor when finished (https://rivet.gg/docs/connections) await counter.dispose();
See setup guide for how to access /* CONNECTION ADDRESS */
.
Apache 2.0
Add Package
deno add jsr:@rivet-gg/actor-client
Import symbol
import * as actor_client from "@rivet-gg/actor-client";
---- OR ----
Import directly with a jsr specifier
import * as actor_client from "jsr:@rivet-gg/actor-client";
Add Package
npx jsr add @rivet-gg/actor-client
Import symbol
import * as actor_client from "@rivet-gg/actor-client";
Add Package
yarn dlx jsr add @rivet-gg/actor-client
Import symbol
import * as actor_client from "@rivet-gg/actor-client";
Add Package
pnpm dlx jsr add @rivet-gg/actor-client
Import symbol
import * as actor_client from "@rivet-gg/actor-client";
Add Package
bunx jsr add @rivet-gg/actor-client
Import symbol
import * as actor_client from "@rivet-gg/actor-client";