pub struct ConnectionSession { /* private fields */ }Expand description
Connection session pool for managing multiple websocket sessions
Implementations§
Source§impl ConnectionSession
impl ConnectionSession
Sourcepub fn new<F, D>(
max_async: usize,
connect_fn: F,
dispatch_fn: D,
api: BotApi,
) -> Self
pub fn new<F, D>( max_async: usize, connect_fn: F, dispatch_fn: D, api: BotApi, ) -> Self
Create a new connection session
Sourcepub fn add_session(&mut self, session: Session)
pub fn add_session(&mut self, session: Session)
Add a session to the connection pool
Sourcepub async fn multi_run(self, session_interval: u64) -> Result<(), BotError>
pub async fn multi_run(self, session_interval: u64) -> Result<(), BotError>
Run multiple sessions with specified interval
Sourcepub fn state(&self) -> Arc<Mutex<ConnectionState>>
pub fn state(&self) -> Arc<Mutex<ConnectionState>>
Get the connection state
Auto Trait Implementations§
impl Freeze for ConnectionSession
impl !RefUnwindSafe for ConnectionSession
impl Send for ConnectionSession
impl Sync for ConnectionSession
impl Unpin for ConnectionSession
impl !UnwindSafe for ConnectionSession
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