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.

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

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.