Related:
See the setup guide on how to deploy a Rivet Actor.
import { TestClient } from "@rivet-gg/actor-client/test"; import type Counter from "./counter.ts"; const client = new TestClient(); // 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) counter.disconnect();
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";