Expand description
A fully asynchronous raw SimpleX client that provides:
-
Requests batching under a heavy load.
-
Complete asynchonisity: futures created by the same instance of a client are fully independent from each other. The event queue receives events independently from client actions.
-
Graceful shutdown with strong guarantees:
-
All futures scheduled before the
.disconnectcall are guaranteed to receive their responses. All futures scheduled after the.disconnectcall are guaranteed to receive thetungstenite::Error::AlreadyClosederror. -
If the web socket connection drops due to an error all already received(buffered) responses are guaranteed to be delivered to corresponding futures. All other pending futures are guaranteed to be resolved with the web socket error.
-
You will receive events for as long as there are futures awaiting responses. After all futures are resolved you will receive all buffered events and then the event queue will be closed.
-
See README on GitHub for diagrams demonstrating how all this works under the hood.
Current implementation heavily depends on tokio runtime and won’t work with other
executors.
Re-exports§
pub use tokio_tungstenite;pub use tokio_tungstenite::tungstenite;
Structs§
- Event
Queue - An event queue buffers events if you’re not actively processing them so it’s recommended to drop it as soon as it no longer needed.
- RawClient
- A lightweight cheaply clonable client capable of sending raw requests(SimpleX commands) and getting raw responses(JSON objects).
Functions§
- connect
- Connect to the running SimpleX daemon by websocket URI str. Note that SimpleX doesn’t support TLS so using “wss://” will produce an error.