Struct tramex_tools::interface::websocket::ws_connection::WsConnection
source · pub struct WsConnection {
pub ws_sender: WsSender,
pub ws_receiver: WsReceiver,
pub msg_id: u64,
pub connecting: bool,
pub asking_size_max: u64,
pub available: bool,
pub name: String,
}
Expand description
WsConnection struct
Fields§
§ws_sender: WsSender
WebSocket sender
ws_receiver: WsReceiver
WebSocket receiver
msg_id: u64
Message ID
connecting: bool
Connecting flag
asking_size_max: u64
Asking size max
available: bool
Available flag
name: String
Name of the receiver
Implementations§
source§impl WsConnection
impl WsConnection
sourcepub fn connect(
url: &str,
wakeup: impl Fn() + Send + Sync + 'static
) -> Result<(WsSender, WsReceiver), String>
pub fn connect( url: &str, wakeup: impl Fn() + Send + Sync + 'static ) -> Result<(WsSender, WsReceiver), String>
Connect to a WebSocket
Errors
Return an error as String if the connection failed - see [ewebsock::connect_with_wakeup
] for more details
sourcepub fn close_impl(&mut self) -> Result<(), TramexError>
pub fn close_impl(&mut self) -> Result<(), TramexError>
Try to close the ws
Errors
Return an error if its fail see [ewebsock::WsSender::close
] for more details
Trait Implementations§
source§impl Debug for WsConnection
impl Debug for WsConnection
source§impl Drop for WsConnection
impl Drop for WsConnection
source§impl InterfaceTrait for WsConnection
impl InterfaceTrait for WsConnection
Auto Trait Implementations§
impl RefUnwindSafe for WsConnection
impl Send for WsConnection
impl !Sync for WsConnection
impl Unpin for WsConnection
impl UnwindSafe for WsConnection
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