Skip to main content

Built and signed on GitHub Actions

🔧 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
70%
Published
2 days ago (24.6.2)
method Client.prototype.get
Client.prototype.get<A = unknown>(
tags: ActorTags,
opts?: GetOptions,
): Promise<ActorHandle<A>>

Gets an actor by its tags, creating it if necessary.

Examples

Example 1

const room = await client.get<ChatRoom>({
  name: 'chat_room',
  // Get or create the actor for the channel `random`
  channel: 'random'
});

// This actor will have the tags: { name: 'chat_room', channel: 'random' }
await room.sendMessage('Hello, world!');

Type Parameters

A = unknown

The actor class that this handle is connected to.

Parameters

tags: ActorTags
  • The tags to identify the actor.
optional
opts: GetOptions
  • Options for getting the actor.

Return Type

  • A promise resolving to the actor handle.

See

Add Package

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

Import symbol

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

---- OR ----

Import directly with a jsr specifier

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

Add Package

npx jsr add @rivet-gg/actor-client

Import symbol

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

Add Package

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

Import symbol

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

Add Package

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

Import symbol

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

Add Package

bunx jsr add @rivet-gg/actor-client

Import symbol

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