Use EmptyRPCSchema for pure client/server connections
mainIf one endpoint only acts as a client (sends requests but doesn't handle any) or only as a server (handles requests but doesn't send messages), use EmptyRPCSchema for the non-participating side. This simplifies the type definition.
type RemoteSchema = RPCSchema<{ requests: { requestName: void; }; }>;
// rpc-local.ts (client)
const rpc = createRPC<EmptyRPCSchema, RemoteSchema>();
// rpc-remote.ts (server)
const rpc = createRPC<RemoteSchema, EmptyRPCSchema>({
requestHandler: {
requestName() { /* ... */ },
},
});