KiteTickerAsync

Struct KiteTickerAsync 

Source
pub struct KiteTickerAsync { /* private fields */ }
Expand description

The WebSocket client for connecting to Kite Connect’s streaming quotes service.

Implementations§

Source§

impl KiteTickerAsync

Source

pub async fn connect(api_key: &str, access_token: &str) -> Result<Self, String>

Establish a connection with the Kite WebSocket server

Source

pub async fn connect_with_options( api_key: &str, access_token: &str, raw_only: bool, ) -> Result<Self, String>

Connect with options

Source

pub async fn subscribe( &mut self, instrument_tokens: &[u32], mode: Option<Mode>, ) -> Result<KiteTickerSubscriber, String>

Subscribes the client to a list of instruments

Source

pub async fn close(&mut self) -> Result<(), String>

Close the websocket connection

Source

pub fn is_connected(&self) -> bool

Check if the connection is still alive

Source

pub async fn ping(&mut self) -> Result<(), String>

Send a ping to keep the connection alive

Source

pub fn receiver_count(&self) -> usize

Get the current broadcast channel receiver count

Source

pub fn channel_capacity(&self) -> usize

Get the current broadcast channel capacity

Source

pub fn subscribe_raw_frames(&self) -> Receiver<Bytes>

Subscribe to raw binary frames (zero-copy). Each item is the full websocket frame bytes.

Use this to implement custom parsing or zero-copy peeking on packet bodies. Each emitted item is a bytes::Bytes that shares the underlying frame buffer (clone is cheap).

See the crate-level docs for an end-to-end example of slicing packet bodies from a frame.

Source

pub fn subscribe_raw(&self) -> Receiver<Bytes>

👎Deprecated: use subscribe_raw_frames() instead; now returns bytes::Bytes

Backward-compatible alias for subscribe_raw_frames.

Source

pub fn subscribe_full_raw(&self) -> KiteTickerRawSubscriber184

Create a subscriber that yields only 184-byte Full tick payloads sliced from frames.

The returned subscriber exposes convenience methods to receive raw Bytes, a fixed [u8;184] reference, or a zerocopy::Ref<&[u8], TickRaw> view via recv_raw_tickraw.

Note: the typed Ref returned by recv_raw_tickraw is valid until the next method call that overwrites the internal buffer. If you need to hold onto the data longer, clone the Bytes and re-create the view as needed using as_tick_raw.

Source

pub fn command_sender(&self) -> Option<UnboundedSender<Message>>

Get a clone of the internal command sender for incremental ops

Trait Implementations§

Source§

impl Debug for KiteTickerAsync

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V