The RPC system allows for several ways to call a remote procedure. The JavaScript implementation is presently more limited.
### C++
*`call` : A normal call that takes arguments and blocks until a return value is received. The call will terminate with a timeout if it takes too long and that throws an exception.
*`asyncCall` : Do a call but use a callback to get the result. It should also but doesn't support futures.
*`send` : A call that does not expect or wait for a return value.
*`findOne` : Broadcasts a call to all known machines and returns the first valid result received.
*`findAll` : Broadcasts a call to all known machines and combines all results into a single vector.
*`broadcast` : Same as `send`, only it goes to every connected machine.
### JavaScript
*`rpc` : Same as `call` in C++
*`send` : Same as `send` in C++
## Modes of Receiving
There are many ways to call a procedure but only one way to receive: `bind`. The signature of the function given to bind determines how it can be called, so here are details on what a function must look like for each kind of call:
*`call` : The bound function must return a value.
*`asyncCall` : The bound function must return a value.
*`send` : The bound function may or may not return a value.
*`findOne` : The bound function must return an `std::optional` value.
*`findAll` : The bound function must return an `std::vector`.
*`broadcast` : The bound function may or may not return value.
## Protocol
### Connection Handshake
Immediately upon connection the following set of calls take place (from a GUI client):
| Server | | Client |
...
...
@@ -18,7 +44,7 @@ Immediately upon connection the following set of calls take place (from a GUI cl
| **URI** | -> | |
## Listing
### Listing
Procedures below that do not have a return value also do not send one and so should be called with `send` instead of `call` which would block forever expecting a return.