Skip to main content

Module native

Module native 

Source
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 Feed carries one crate::live::Session over tokio-tungstenite and hands back crate::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_warm reads, 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::Clock for a native program. A clock set before 1970 reads 0.
keep_warm
Warms client every every while anything else holds it, and ends by itself once the last holder lets go. Each warm is Client::warm: one of the lightest reads, never signed.