pub struct WsClient { /* private fields */ }
Expand description
Longbridge Websocket client
Implementations§
Source§impl WsClient
impl WsClient
Sourcepub async fn open(
request: impl IntoClientRequest,
version: ProtocolVersion,
codec: CodecType,
platform: Platform,
event_sender: UnboundedSender<WsEvent>,
rate_limit: Option<RateLimit>,
) -> WsClientResult<Self>
pub async fn open( request: impl IntoClientRequest, version: ProtocolVersion, codec: CodecType, platform: Platform, event_sender: UnboundedSender<WsEvent>, rate_limit: Option<RateLimit>, ) -> WsClientResult<Self>
Connect to url
and returns a WsClient
object
Sourcepub async fn request_auth(
&self,
otp: impl Into<String>,
) -> WsClientResult<WsSession>
pub async fn request_auth( &self, otp: impl Into<String>, ) -> WsClientResult<WsSession>
Send an authentication request to get a WsSession
Reference: https://open.longbridgeapp.com/en/docs/socket-token-api Reference: https://open.longbridgeapp.com/en/docs/socket/control-command#auth
Sourcepub async fn request_reconnect(
&self,
session_id: impl Into<String>,
) -> WsClientResult<WsSession>
pub async fn request_reconnect( &self, session_id: impl Into<String>, ) -> WsClientResult<WsSession>
Send a reconnect request to get a WsSession
Reference: https://open.longbridgeapp.com/en/docs/socket/control-command#reconnect
Sourcepub async fn request_raw(
&self,
command_code: u8,
timeout: Option<Duration>,
body: Vec<u8>,
) -> WsClientResult<Vec<u8>>
pub async fn request_raw( &self, command_code: u8, timeout: Option<Duration>, body: Vec<u8>, ) -> WsClientResult<Vec<u8>>
Send a raw request
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WsClient
impl RefUnwindSafe for WsClient
impl Send for WsClient
impl Sync for WsClient
impl Unpin for WsClient
impl UnwindSafe for WsClient
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