Crate simploxide_core

Crate simploxide_core 

Source
Expand description

A fully asynchronous raw SimpleX client that provides:

  1. Requests batching under a heavy load.

  2. 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.

  3. Graceful shutdown with strong guarantees:

    • All futures scheduled before the .disconnect call are guaranteed to receive their responses. All futures scheduled after the .disconnect call are guaranteed to receive the tungstenite::Error::AlreadyClosed error.

    • 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§

EventQueue
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.

Type Aliases§

Error
Event
EventReceiver
RawEventQueue
Response
Result