JVM | Platform | Status |
---|---|---|
OpenJDK (Temurin) Current | Linux | |
OpenJDK (Temurin) LTS | Linux | |
OpenJDK (Temurin) Current | Windows | |
OpenJDK (Temurin) LTS | Windows |
An API specification for simple RPC clients.
Many io7m projects implement some form of RPC client. The Hibiscus API is an attempt to define some common interface types so that unrelated projects nevertheless end up with a consistent look and feel across client implementations.
- A
Configuration
is passed to aClientFactory
to produce aClient
. - The
Client
sendsConnectionParameters
to the server to log in. - The
Server
sends backMessages
indicating if the login succeeded or failed. - Assuming success, the
Client
sendsMessages
to the server to perform operations. - The
Server
sendsMessages
in response toMessages
.
Clients conform to a simple state machine:
- Clients begin in the
DISCONNECTED
state. - A
Login
operation moves the client into theCONNECTING
state. - If the login succeeds, the client moves to the
CONNECTED
state after passing through theCONNECTION_SUCCEEDED
state. - If the login fails, the client moves to the
DISCONNECTED
state after passing through theCONNECTION_FAILED
state.
In the CONNECTED
state, the client can:
- Disconnect, moving to the
DISCONNECTED
state. - Send messages, remaining in the
CONNECTED
state.
A client maintains an internal Transport that performs the actual communication.
A Transport represents an object that can be used to read and write messages. A Transport exposes the following operations:
receive
: Read a message from the transport.sendAndForget
: Write a message to the transport, potentially discarding any response that might come back.sendAndWait
: Write a message to the transport and wait for a response to come back.send
: Write a message to the transport but do not wait for a response to come back. The response can be fetched later withreceive
.
The package includes multiple example transports:
- EUDP0Transport - A UDP transport
- ETCP0Transport - A TCP transport
- EHTTP0Transport - An HTTP transport