pub struct WsService { /* private fields */ }Implementations§
Source§impl WsService
impl WsService
pub fn new(url: Url, access_token: Option<String>) -> Self
pub fn new_with_options( url: Url, access_token: Option<String>, auto_reconnect: Option<bool>, reconnect_interval: Option<Duration>, max_reconnect_times: Option<u32>, ) -> Self
pub fn builder(url: &str) -> Result<WsServiceBuilder, ParseError>
Source§impl WsService
impl WsService
pub fn get_url(&self) -> Url
pub async fn connect( url: impl ToString, ) -> Result<WebSocketStream<MaybeTlsStream<TcpStream>>, Error>
pub async fn send_processor( send_side: SplitSink<WebSocketStream<MaybeTlsStream<TcpStream>>, Message>, api_receiver: InternalAPIReceiver, close_signal: Receiver<()>, connection_close_signal: Receiver<()>, ) -> Result<()>
pub async fn read_processor( read_side: SplitStream<WebSocketStream<MaybeTlsStream<TcpStream>>>, event_sender: InternalEventSender, close_signal: Receiver<()>, connection_close_signal_sender: Sender<()>, ) -> Result<()>
pub async fn spawn_processor(&self) -> ServiceStartResult<()>
pub async fn reconnect(&self, reconnect_times: u32) -> Result<()>
pub async fn reconnect_processor(self) -> Result<()>
Trait Implementations§
Source§impl CommunicationService for WsService
impl CommunicationService for WsService
Source§fn install(
&mut self,
api_receiver: InternalAPIReceiver,
event_sender: InternalEventSender,
)
fn install( &mut self, api_receiver: InternalAPIReceiver, event_sender: InternalEventSender, )
安装服务
该方法仅进行服务的依赖注入,并不真正创建任务
应具备幂等性
该方法仅进行服务的依赖注入,并不真正创建任务
应具备幂等性
Auto Trait Implementations§
impl Freeze for WsService
impl !RefUnwindSafe for WsService
impl Send for WsService
impl Sync for WsService
impl Unpin for WsService
impl UnsafeUnpin for WsService
impl !UnwindSafe for WsService
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