Struct longport_wscli::WsClient
source · pub struct WsClient { /* private fields */ }Expand description
LongPort 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.longportapp.com/en/docs/socket-token-api Reference: https://open.longportapp.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.longportapp.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 !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