Caller
Make your procedures callable in oRPC.
Direct Procedure Calls
You can directly call a procedure if its Global Context can accept undefined
.
For security reasons, context cannot be passed when invoking such procedures directly.
Calling Procedures with Context
For context-sensitive calls, use a Procedure Caller. A Procedure Caller securely provides the required context during invocation.
Now, you can provide context when invoking a procedure.
Additionally, you can use gettingCaller
as a Server Action.
Calling Routers with Shared Context
To call multiple procedures with shared context, use a Router Caller
.
Summary
- Direct Calls: Use when no context is required, or the context accepts
undefined
. - Procedure Caller: Use for securely calling a single procedure with a specific context.
- Router Caller: Use for securely calling multiple procedures with shared context.
oRPC provides flexible and secure ways to invoke procedures tailored to your application needs.