Welcome to Rivet
Rivet is a powerful platform for building real-time applications. At the core of Rivet are Actors, with built-in support for remote procedure calls, state, events, and edge networking.
Why use Rivet Actors?
Rivet Actors offer several compelling advantages for building real-time applications:
- Enhanced Performance: By integrating compute (i.e., "RPC") with data (i.e., "state"), performance is significantly improved.
- Simplified Architecture: Replace complex infrastructure (e.g., caches, queues, pub/sub) with actors for a more straightforward architecture.
- Built-in Fault Tolerance: Actors provide natural fault tolerance as state is durable and failures do not cascade.
- Reduced Latency: Achieve lower latency for users by running at the edge and combining compute with data.
Core primitives
- Remote Procedure Call (RPC) is how clients communicate with actors and how actors communicate with each other.
- State is the data belonging to each actor. State cannot be shared between actors. State is stored in memory (unless it's too large) for fast reads and writes. State is durable and will always survive a crash or upgrade. You can update state without having to do anything special.
- Events are used for real-time communication between clients and actors. Clients can subscribe to events with
actor.on("myEvent")
, and actors can publish events withthis._broadcast("myEvent")
orconnection.send("myEvent")
. - Connections represent a client that's currently connected to the actor. Connections have their own state, e.g.,
userId
. You can useonConnect
to authenticate connections before they can communicate with the actor.
To read more about architecting actors for scale, see here.