Skip to main content

Crate pale

Crate pale 

Source
Expand description

§pale

A Reconnecting, subscription keeping, clonable JSON RPC 2.0 Websocket Client in Rust

[!WARNING]
Use on your own risk, this was just made to suit a very specific use case that i personally needed.
I have not benchmarked this or checked any performance. And isn’t thoroughly tested and probably have issues.
But hopefully the code isn’t too much to scan over if you encounter any issues <3

§Example

// create & connect a client
let client = Client::new("ws://example.com", ClientConfig::default()).await?;

// a simple request
let data = client.request::<Vec<i32>>("example/method", params![("param_name", true)]).await?;

// a subscription stream
let mut sub = client.subscribe::<String>("example/notification").await?;
while let Some(data) = sub.next().await {
    println!("{data:?}");
}

Macros§

params
Can be used to easily insert parameters into [Client::request] functions.

Structs§

Client
A JSON RPC 2.0 Websocket Client.
ClientConfig
The config used for Client.
NotisResponse
RPCError
RPCRequest
RPCResponse
WebSocketConfig
The configuration for WebSocket connection.

Enums§

PaleError

Traits§

StreamExt
An extension trait for Streams that provides a variety of convenient combinator functions.

Type Aliases§

Result