This is the specification of the Protocol Buffers that wasm/node modules will use to setup their RPC interfaces with the central RPC server.
Borrowed from gRPC
Overall in the MVP of this RPC Framework only the above server and node implimentation will be used. Direct node communication will not be supported.
When a node is initialized it will pass a protobuf describing it's functions and how to call them. Once initialized any other module or direct JS Call can be made to that module.
The blue nodes above represent the wasm modules that wRPC will orchestrate. Eventually wRPC will communicate with more traditional RPC frameworks such as gRPC.
- Will Data be returned as another proto or as a direct JS value?
- Will the core be written in JS or Wasm?
- What's the best way to make this easy for other Devs to use?
- What are some default failure modes/exceptions?
The information that the initialization proto will provide are as follows
- Module name
- How to initialize
- Any extra steps to call functions
- Functions
- name
- params
- return type
- failure types?
- async?
- Public info/Data
- Meta data?
.. literalinclude:: examples/RPC_Module.proto :language: proto
The idea of this protobuf response is based on Rust's std::option type. Depending on the error and if the remote client can raise an exception wRPC may insert a generic failure.
- Success/Fail
- if fail why
- Data
.. literalinclude:: examples/result.proto :language: proto
See the examples folder.
See :ref:`js_bindings` for how to interact with JavaScript.