Struct binance::websockets::WebSockets
source · pub struct WebSockets<'a, WE> {
pub socket: Option<(WebSocketStream<MaybeTlsStream<TcpStream>>, Response)>,
/* private fields */
}Fields§
§socket: Option<(WebSocketStream<MaybeTlsStream<TcpStream>>, Response)>Implementations§
source§impl<'a, WE: DeserializeOwned> WebSockets<'a, WE>
impl<'a, WE: DeserializeOwned> WebSockets<'a, WE>
sourcepub fn new<Callback>(handler: Callback) -> WebSockets<'a, WE>where
Callback: FnMut(WE) -> Result<()> + 'a + Send,
pub fn new<Callback>(handler: Callback) -> WebSockets<'a, WE>where
Callback: FnMut(WE) -> Result<()> + 'a + Send,
sourcepub fn new_with_options<Callback>(
handler: Callback,
conf: Config
) -> WebSockets<'a, WE>where
Callback: FnMut(WE) -> Result<()> + 'a + Send,
pub fn new_with_options<Callback>(
handler: Callback,
conf: Config
) -> WebSockets<'a, WE>where
Callback: FnMut(WE) -> Result<()> + 'a + Send,
sourcepub async fn connect_multiple(&mut self, endpoints: Vec<String>) -> Result<()>
pub async fn connect_multiple(&mut self, endpoints: Vec<String>) -> Result<()>
Connect to multiple websocket endpoints N.B: WE has to be CombinedStreamEvent
sourcepub async fn disconnect(&mut self) -> Result<()>
pub async fn disconnect(&mut self) -> Result<()>
Disconnect from the endpoint