pub struct StreamingClient { /* private fields */ }stream only.Expand description
A live Lightstreamer session with active subscriptions.
Obtained via StreamingApi::connect or StreamingApi::connect_with.
All subscription methods return a tokio::sync::mpsc::Receiver<T>.
Dropping the receiver automatically cancels the subscription server-side
the next time the server sends an update for that item.
Call StreamingClient::disconnect to cleanly tear down the session.
Implementations§
Source§impl StreamingClient
impl StreamingClient
Sourcepub async fn subscribe_market(
&self,
epic: &str,
) -> Result<Receiver<MarketUpdate>>
pub async fn subscribe_market( &self, epic: &str, ) -> Result<Receiver<MarketUpdate>>
Subscribe to market price updates for epic.
Returns a Receiver<MarketUpdate>. Each received value is a snapshot
of all changed fields merged with the previous state — no field is
ever “missing”.
Sourcepub async fn subscribe_chart_tick(
&self,
epic: &str,
) -> Result<Receiver<ChartTickUpdate>>
pub async fn subscribe_chart_tick( &self, epic: &str, ) -> Result<Receiver<ChartTickUpdate>>
Subscribe to chart tick data for epic.
Returns a Receiver<ChartTickUpdate>. This is a DISTINCT-mode
subscription — every message is a fresh tick, not a merge.
Sourcepub async fn subscribe_chart_candle(
&self,
epic: &str,
scale: CandleScale,
) -> Result<Receiver<ChartCandleUpdate>>
pub async fn subscribe_chart_candle( &self, epic: &str, scale: CandleScale, ) -> Result<Receiver<ChartCandleUpdate>>
Subscribe to OHLC candle data for epic at scale.
Returns a Receiver<ChartCandleUpdate>. This is a MERGE-mode
subscription — fields are merged across updates for the current candle.
Sourcepub async fn subscribe_account(
&self,
account_id: &str,
) -> Result<Receiver<AccountUpdate>>
pub async fn subscribe_account( &self, account_id: &str, ) -> Result<Receiver<AccountUpdate>>
Subscribe to account balance and margin updates.
Returns a Receiver<AccountUpdate>.
Sourcepub async fn subscribe_trade(
&self,
account_id: &str,
) -> Result<Receiver<TradeUpdate>>
pub async fn subscribe_trade( &self, account_id: &str, ) -> Result<Receiver<TradeUpdate>>
Subscribe to trade confirmations and working-order updates.
Returns a Receiver<TradeUpdate>.
Sourcepub async fn disconnect(self) -> Result<()>
pub async fn disconnect(self) -> Result<()>
Disconnect from Lightstreamer and stop the background read-loop task.
After this call all pending Receivers will no longer receive updates.
The method signature is async for forward compatibility (future
implementations may need to await a clean shutdown handshake with the
server).
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Return the current Lightstreamer session ID.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StreamingClient
impl !RefUnwindSafe for StreamingClient
impl Send for StreamingClient
impl Sync for StreamingClient
impl Unpin for StreamingClient
impl UnsafeUnpin for StreamingClient
impl !UnwindSafe for StreamingClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more