跳到主要内容

RPC

查看 Markdown

This page lists the TypeScript SDK names for RPCs. The doc comment of each API gives its parameters, defaults, and errors. Read them in the TypeScript SDK API reference.

API names​

TaskTypeScript APIDex behavior
Define an RPC handler@rpc on a Flow method, or declareRPCMethodFlow definition
Set the durable RPC namename of RPCOptions. It defaults to the method name.Flow definition
Set the RPC timeouttimeoutMs of RPCOptionsRPC timeout
Lock Attributes for the whole calllockAttributes of RPCOptionsLocks
Request transactional reads and writes without locksisTransactional of RPCOptionsTransactional RPCs
Load AttributeMap values and Channel messagesloadAttributeMaps, loadAttributeMapInstances, loadChannels, loadChannelMaps, and loadChannelMapInstances of RPCOptionsSelective state loading
Return the output and start next StepsRPCResult, with output and nextStepsRPCs
Cancel running StepscancelingSteps of RPCResultCancel running Steps
Let a person invoke the RPC from Dex Webaction of RPCOptions, with ActionActions
Invoke the RPC from a ClientClient.invokeRPCInvoke an RPC
Lock or load map instances chosen at call timeRPCInvokeOptions, with Client.invokeRPCWithOptionsRuntime-selected map instances

@rpc and declareRPCMethod take the same RPCOptions.

RPC codecs​

TypeScript uses JSON when inputCodec or outputCodec is omitted. Provide a codec when the input or output is not JSON, including scalar values such as strings, numbers, booleans, and bigints.

Example​

Example: examples/typescript/src/primitives/rpc/rpc-flow.ts