feat: ✨ websocket client
This commit is contained in:
parent
3b122dc4f7
commit
978f082146
5 changed files with 166 additions and 146 deletions
|
@ -21,8 +21,14 @@ pub struct User {
|
|||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum Error {
|
||||
UnexpectedSignalType(SignalType),
|
||||
InvalidSignalType(String),
|
||||
UnexpectedSignalType(SignalType),
|
||||
WebSocketInit,
|
||||
WebSocketAuth,
|
||||
WebSocketSend,
|
||||
WebSocketReceivedNothing,
|
||||
WebSocketReceiveQueueReset,
|
||||
WebSocketReceiveQueueLocked,
|
||||
}
|
||||
|
||||
impl std::error::Error for Error {
|
||||
|
@ -34,12 +40,20 @@ impl std::error::Error for Error {
|
|||
impl Display for Error {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Error::UnexpectedSignalType(signal_type) => {
|
||||
write!(f, "Unexpected Signal Type: {}", signal_type)
|
||||
}
|
||||
Error::InvalidSignalType(invalid_signal_type) => {
|
||||
write!(f, "Invalid Signal Type: {}", invalid_signal_type)
|
||||
}
|
||||
|
||||
Error::UnexpectedSignalType(signal_type) => {
|
||||
write!(f, "Unexpected Signal Type: {}", signal_type)
|
||||
}
|
||||
|
||||
Error::WebSocketInit => write!(f, "WebSocket Initialization"),
|
||||
Error::WebSocketAuth => write!(f, "WebSocket Auth"),
|
||||
Error::WebSocketSend => write!(f, "WebSocket Send"),
|
||||
Error::WebSocketReceivedNothing => write!(f, "WebSocket Received Nothing"),
|
||||
Error::WebSocketReceiveQueueReset => write!(f, "WebSocket Receive Queue Reset"),
|
||||
Error::WebSocketReceiveQueueLocked => write!(f, "WebSocket Receive Queue Locked"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue