pub struct Stream {
pub client: Client,
}Expand description
Manages WebSocket streaming connections to the Limitless Exchange.
Connects to wss://ws.limitless.exchange/markets and provides
methods for subscribing to public and private data streams.
Protocol note: The Limitless WS uses Socket.IO protocol over raw WebSocket. This implementation handles the raw WebSocket transport; callers should frame Socket.IO packets (namespace connect, event emit/receive) on top of this stream.
§Event Reference
| Client → Server (emit) | Auth | Description |
|---|---|---|
subscribe_market_prices | No | AMM prices + CLOB orderbook |
subscribe_positions | Yes | Portfolio position updates |
subscribe_order_events | Yes | OME + settlement lifecycle |
subscribe_market_lifecycle | No | Market creation / resolution |
| Server → Client (on) | Auth | Description |
|---|---|---|
newPriceData | No | AMM price update |
orderbookUpdate | No | CLOB orderbook snapshot |
positions | Yes | Position balance change |
orderEvent | Yes | OME state or settlement result |
marketCreated | No | New market funded and visible |
marketResolved | No | Market resolved with winning outcome |
system | — | System notifications |
authenticated | Yes | Auth confirmation |
exception | — | Error notifications |
Fields§
§client: ClientImplementations§
Source§impl Stream
impl Stream
Sourcepub async fn ws_ping(&self) -> Result<(), LimitlessError>
pub async fn ws_ping(&self) -> Result<(), LimitlessError>
Tests connectivity by sending a WebSocket ping.
Sourcepub async fn ws_subscribe<F>(&self, handler: F) -> Result<(), LimitlessError>
pub async fn ws_subscribe<F>(&self, handler: F) -> Result<(), LimitlessError>
Subscribe to a public data stream with an event handler callback.
The handler receives raw JSON Value for each incoming message
that is not a control frame (Ping/Pong/Close).
§Example
use limitless::prelude::*;
#[tokio::main]
async fn main() {
let stream: Stream = Limitless::new(None, None);
stream
.ws_subscribe(|event| {
println!("Received: {:?}", event);
Ok(())
})
.await
.unwrap();
}Sourcepub async fn ws_subscribe_with_commands<F>(
&self,
cmd_receiver: UnboundedReceiver<String>,
handler: F,
) -> Result<(), LimitlessError>
pub async fn ws_subscribe_with_commands<F>( &self, cmd_receiver: UnboundedReceiver<String>, handler: F, ) -> Result<(), LimitlessError>
Subscribe to a stream with dynamic command support.
Allows emitting subscription commands (subscribe/unsubscribe) after
the connection is established. Send JSON command strings through
the cmd_sender channel.