0.2.0
This commit is contained in:
@@ -330,38 +330,84 @@ fn kb_emit_app_log(app_handle: &tauri::AppHandle, message: &str) {
|
||||
}
|
||||
}
|
||||
|
||||
fn kb_format_ws_event(event: &kb_lib::WsEvent) -> std::string::String {
|
||||
fn kb_format_ws_event(
|
||||
event: &kb_lib::WsEvent,
|
||||
) -> std::string::String {
|
||||
match event {
|
||||
kb_lib::WsEvent::Connected {
|
||||
endpoint_name,
|
||||
endpoint_url,
|
||||
} => {
|
||||
format!("[ws:{endpoint_name}] connected to {endpoint_url}")
|
||||
}
|
||||
},
|
||||
kb_lib::WsEvent::TextMessage {
|
||||
endpoint_name,
|
||||
text,
|
||||
} => {
|
||||
format!("[ws:{endpoint_name}] text: {text}")
|
||||
}
|
||||
},
|
||||
kb_lib::WsEvent::JsonRpcMessage {
|
||||
endpoint_name,
|
||||
message,
|
||||
} => {
|
||||
match message {
|
||||
kb_lib::KbJsonRpcWsIncomingMessage::SuccessResponse(response) => {
|
||||
format!(
|
||||
"[ws:{endpoint_name}] json-rpc success id={} result={}",
|
||||
response.id,
|
||||
response.result
|
||||
)
|
||||
},
|
||||
kb_lib::KbJsonRpcWsIncomingMessage::ErrorResponse(response) => {
|
||||
format!(
|
||||
"[ws:{endpoint_name}] json-rpc error id={} code={} message={}",
|
||||
response.id,
|
||||
response.error.code,
|
||||
response.error.message
|
||||
)
|
||||
},
|
||||
kb_lib::KbJsonRpcWsIncomingMessage::Notification(notification) => {
|
||||
format!(
|
||||
"[ws:{endpoint_name}] json-rpc notification method={} subscription={} result={}",
|
||||
notification.method,
|
||||
notification.params.subscription,
|
||||
notification.params.result
|
||||
)
|
||||
},
|
||||
}
|
||||
},
|
||||
kb_lib::WsEvent::JsonRpcParseError {
|
||||
endpoint_name,
|
||||
text,
|
||||
error,
|
||||
} => {
|
||||
format!(
|
||||
"[ws:{endpoint_name}] json-rpc parse error: {} | raw={}",
|
||||
error,
|
||||
text
|
||||
)
|
||||
},
|
||||
kb_lib::WsEvent::BinaryMessage {
|
||||
endpoint_name,
|
||||
data,
|
||||
} => {
|
||||
format!("[ws:{endpoint_name}] binary message ({} bytes)", data.len())
|
||||
}
|
||||
format!(
|
||||
"[ws:{endpoint_name}] binary message ({} bytes)",
|
||||
data.len()
|
||||
)
|
||||
},
|
||||
kb_lib::WsEvent::Ping {
|
||||
endpoint_name,
|
||||
data,
|
||||
} => {
|
||||
format!("[ws:{endpoint_name}] ping ({} bytes)", data.len())
|
||||
}
|
||||
},
|
||||
kb_lib::WsEvent::Pong {
|
||||
endpoint_name,
|
||||
data,
|
||||
} => {
|
||||
format!("[ws:{endpoint_name}] pong ({} bytes)", data.len())
|
||||
}
|
||||
},
|
||||
kb_lib::WsEvent::CloseReceived {
|
||||
endpoint_name,
|
||||
code,
|
||||
@@ -369,18 +415,21 @@ fn kb_format_ws_event(event: &kb_lib::WsEvent) -> std::string::String {
|
||||
} => {
|
||||
format!(
|
||||
"[ws:{endpoint_name}] close received code={:?} reason={:?}",
|
||||
code, reason
|
||||
code,
|
||||
reason
|
||||
)
|
||||
}
|
||||
kb_lib::WsEvent::Disconnected { endpoint_name } => {
|
||||
},
|
||||
kb_lib::WsEvent::Disconnected {
|
||||
endpoint_name,
|
||||
} => {
|
||||
format!("[ws:{endpoint_name}] disconnected")
|
||||
}
|
||||
},
|
||||
kb_lib::WsEvent::Error {
|
||||
endpoint_name,
|
||||
error,
|
||||
} => {
|
||||
format!("[ws:{endpoint_name}] error: {error}")
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user