Expand description
HTTP and websocket for native programs: Native sends requests through
reqwest on rustls, clock is the system clock, and a Feed keeps the
websocket open over tokio-tungstenite. Hand the first two to a
crate::Client:
use df_hyperliquid_core::client::native::{Native, clock};
use df_hyperliquid_core::{Client, Network};
let client = Client::reader(Native::new(), Network::Mainnet, clock);A Native future must be polled inside a tokio runtime. Nothing here
retries. keep_warm holds a client’s connection open between orders, so
the first one after a quiet spell skips DNS and the TLS handshake.
Re-exports§
pub use socket::Feed;
Modules§
- socket
- The websocket for native programs: a
Feedcarries onecrate::live::Sessionover tokio-tungstenite and hands backcrate::live::Events, each frame’s text beside it when asked. Subscriptions made while down are sent on the next open; a post made while down is refused, and one cut off by a drop is reported, never resent.
Structs§
- Native
- One HTTP client, cheap to clone: clones share their connections.
Constants§
- KEEP_
WARM - How often
keep_warmreads, well inside the time a pooled connection is kept idle. - TIMEOUT
- How long a request may take, connection and answer together, unless the program says otherwise.
Functions§
- clock
- Unix milliseconds from the system clock: the
crate::client::Clockfor a native program. A clock set before 1970 reads 0. - keep_
warm - Warms
clienteveryeverywhile anything else holds it, and ends by itself once the last holder lets go. Each warm isClient::warm: one of the lightest reads, never signed.