pub trait WebsocketClientCallback: Sync + Send {
// Required methods
fn connected(&self) -> bool;
fn disconnected(&self);
fn error(&self, msg: &str);
fn read(&self, data: &[u8]) -> bool;
}Required Methods§
Sourcefn connected(&self) -> bool
fn connected(&self) -> bool
Receive a notification that the websocket connection has been connected successfully.
Return false if you would like to terminate the connection early.
Sourcefn disconnected(&self)
fn disconnected(&self)
Receive a notification that the websocket connection has been terminated.
For implementations, you must call this at the end of the websocket connection lifecycle even if you notify the client of an error.