binance_core/websocket/
supervisor.rs1use binance_common::enums::WebSocketType;
2
3pub trait WebSocketSupervisor {
4 type Error;
5 type Response;
6 type State;
7
8 fn new(websocket_type: WebSocketType) -> Self;
9 fn start(&mut self, route: String) -> impl Future<Output = Result<(), Self::Error>> + Send;
10 fn stop(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send;
11 fn restart(&mut self, route: String) -> impl Future<Output = Result<(), Self::Error>> + Send;
12 fn get_state(&mut self) -> impl Future<Output = Result<Self::State, Self::Error>> + Send;
13 fn watch(
14 &mut self,
15 ) -> impl Future<
16 Output = Result<
17 tokio::sync::watch::Receiver<Result<Self::Response, Self::Error>>,
18 Self::Error,
19 >,
20 > + Send;
21}