pub struct BybitWebSocket { /* private fields */ }Expand description
WebSocket client for Bybit streaming API.
Implementations§
Source§impl BybitWebSocket
impl BybitWebSocket
Sourcepub fn private(api_key: &str, api_secret: &str, url: &str) -> Self
pub fn private(api_key: &str, api_secret: &str, url: &str) -> Self
Create a new private WebSocket client.
Sourcepub async fn subscribe<F>(
&mut self,
topics: Vec<String>,
callback: F,
) -> Result<()>
pub async fn subscribe<F>( &mut self, topics: Vec<String>, callback: F, ) -> Result<()>
Subscribe to topics.
§Arguments
topics- List of topics to subscribecallback- Callback function for received messages
Sourcepub async fn unsubscribe(&mut self, topics: Vec<String>) -> Result<()>
pub async fn unsubscribe(&mut self, topics: Vec<String>) -> Result<()>
Unsubscribe from topics.
Sourcepub async fn is_connected(&self) -> bool
pub async fn is_connected(&self) -> bool
Check if connected.
Sourcepub async fn disconnect(&mut self) -> Result<()>
pub async fn disconnect(&mut self) -> Result<()>
Disconnect from the server.
Auto Trait Implementations§
impl Freeze for BybitWebSocket
impl !RefUnwindSafe for BybitWebSocket
impl Send for BybitWebSocket
impl Sync for BybitWebSocket
impl Unpin for BybitWebSocket
impl UnsafeUnpin for BybitWebSocket
impl !UnwindSafe for BybitWebSocket
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