Rivet Actor
Rivet Actors have built-in RPC, state, and events — the easiest way to build modern applications.
Getting Started
Usage
Make sure you've installed the Rivet CLI.
rivet init
rivet deploy
See the setup guide for more information.
Example
import { Actor } from "@rivet-gg/actor";
import type { Rpc } from "@rivet-gg/actor";
interface State {
count: number;
}
export default class Counter extends Actor<State> {
override _onInitialize(): State {
return { count: 0 };
}
override _onStateChange(newState: State): void | Promise<void> {
this._broadcast("count", newState.count);
}
increment(_rpc: Rpc<Counter>, count: number): number {
this._state.count += count;
return this._state.count;
}
}
Related Packages
License
Apache 2.0