Skip to content

Commit 060830f

Browse files
committed
doc: write instructions for standalone and embedded APIs
1 parent 5f9a58a commit 060830f

1 file changed

Lines changed: 25 additions & 4 deletions

File tree

README.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,37 @@ which serves as the node non-blocking reactor-based (see [`io-reactor`]) microse
2222
The node daemon has the following components:
2323

2424
- **Broker**, integrating all services and managing their communications;
25-
- **RPC**: reactor-based thread managing incoming client connections, notifying them about changes
26-
to the subscribed information;
25+
- **RPC**: reactor-based thread managing incoming client connections,
26+
notifying them about changes to the subscribed information;
2727
- ...
2828

2929
By default, the node exposes a binary RPC API over TCP, which can be exposed as more high-level APIs
30-
(HTTP REST, Websocket-based or JSON-RPC) using special adaptor services.
30+
(HTTP REST, Websocket-based, or JSON-RPC) using special adaptor services.
31+
32+
## Building clients
33+
34+
RGB Node can be run in two modes:
35+
as a standalone server and as a multithreaded service embedded into some other process.
36+
37+
### Standalone server
38+
39+
The mode is turned on using `server` feature flag and leads to production of `rgbd` executable.
40+
The binary can be run as a daemon, and accessed via binary RGB RPC interface.
41+
The use of the RPC API can be simplified through `rgb-client` crate, providing high-level API.
42+
43+
### Embedded service
44+
45+
The mode is turned on using `embedded` feature flag and leads to production of `rgbnode` library.
46+
To run RGB Node inside any app in this mode please call `Broker::start_embedded`,
47+
giving in the method arguments a configuration and instantiated persistence provider.
48+
The method returns `Broker` instance; call `Broker::client` to receive an `AsyncClient` which can
49+
be used to process all calls to the node.
50+
51+
NB: Do not forget to join the `Broker` thread from the main app by calling `Broker::run` method.
3152

3253
## OS Support
3354

34-
The project currently supports Linux, macOS and UNIX.
55+
The project currently supports Linux, macOS, and UNIX.
3556
Windows support is a work-in-progress, requiring downstream [`io-reactor`] framework changes.
3657

3758
[`io-reactor`]: https://github.com/rust-amplify/io-reactor

0 commit comments

Comments
 (0)