pub struct ManagedConnection {
pub id: ChannelId,
pub ticker: Option<KiteTickerAsync>,
pub subscriber: Option<KiteTickerSubscriber>,
pub subscribed_symbols: HashMap<u32, Mode>,
pub stats: Arc<RwLock<ConnectionStats>>,
pub is_healthy: Arc<AtomicBool>,
pub last_ping: Arc<AtomicU64>,
pub task_handle: Option<JoinHandle<()>>,
pub heartbeat_handle: Option<JoinHandle<()>>,
pub message_sender: UnboundedSender<TickerMessage>,
/* private fields */
}Expand description
Represents a single WebSocket connection with its metadata
Fields§
§id: ChannelId§ticker: Option<KiteTickerAsync>§subscriber: Option<KiteTickerSubscriber>§subscribed_symbols: HashMap<u32, Mode>§stats: Arc<RwLock<ConnectionStats>>§is_healthy: Arc<AtomicBool>§last_ping: Arc<AtomicU64>§task_handle: Option<JoinHandle<()>>§heartbeat_handle: Option<JoinHandle<()>>§message_sender: UnboundedSender<TickerMessage>Implementations§
Source§impl ManagedConnection
impl ManagedConnection
pub fn new( id: ChannelId, message_sender: UnboundedSender<TickerMessage>, ) -> Self
Sourcepub async fn connect(
&mut self,
api_key: &str,
access_token: &str,
config: &KiteManagerConfig,
) -> Result<(), String>
pub async fn connect( &mut self, api_key: &str, access_token: &str, config: &KiteManagerConfig, ) -> Result<(), String>
Connect to WebSocket and start message processing
Sourcepub async fn connect_with_raw(
&mut self,
api_key: &str,
access_token: &str,
config: &KiteManagerConfig,
raw_only: bool,
) -> Result<(), String>
pub async fn connect_with_raw( &mut self, api_key: &str, access_token: &str, config: &KiteManagerConfig, raw_only: bool, ) -> Result<(), String>
Connect with explicit raw_only flag
Sourcepub async fn subscribe_symbols(
&mut self,
symbols: &[u32],
mode: Mode,
) -> Result<(), String>
pub async fn subscribe_symbols( &mut self, symbols: &[u32], mode: Mode, ) -> Result<(), String>
Subscribe to symbols on this connection
Sourcepub async fn add_symbols(
&mut self,
symbols: &[u32],
mode: Mode,
) -> Result<(), String>
pub async fn add_symbols( &mut self, symbols: &[u32], mode: Mode, ) -> Result<(), String>
Dynamically add new symbols to existing subscription
Sourcepub async fn remove_symbols(&mut self, symbols: &[u32]) -> Result<(), String>
pub async fn remove_symbols(&mut self, symbols: &[u32]) -> Result<(), String>
Dynamically remove symbols from existing subscription
Sourcepub async fn start_message_processing(&mut self) -> Result<(), String>
pub async fn start_message_processing(&mut self) -> Result<(), String>
Start message processing for the subscriber
Sourcepub fn can_accept_symbols(
&self,
count: usize,
max_per_connection: usize,
) -> bool
pub fn can_accept_symbols( &self, count: usize, max_per_connection: usize, ) -> bool
Check if connection can accept more symbols
Sourcepub fn symbol_count(&self) -> usize
pub fn symbol_count(&self) -> usize
Get current symbol count
Sourcepub fn is_healthy(&self) -> bool
pub fn is_healthy(&self) -> bool
Check if connection is healthy
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ManagedConnection
impl !RefUnwindSafe for ManagedConnection
impl Send for ManagedConnection
impl Sync for ManagedConnection
impl Unpin for ManagedConnection
impl !UnwindSafe for ManagedConnection
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
Mutably borrows from an owned value. Read more