0.3.0
This commit is contained in:
@@ -330,9 +330,7 @@ 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,
|
||||
@@ -349,31 +347,26 @@ fn kb_format_ws_event(
|
||||
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
|
||||
)
|
||||
},
|
||||
} => 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 {
|
||||
@@ -383,31 +376,75 @@ fn kb_format_ws_event(
|
||||
} => {
|
||||
format!(
|
||||
"[ws:{endpoint_name}] json-rpc parse error: {} | raw={}",
|
||||
error,
|
||||
text
|
||||
error, text
|
||||
)
|
||||
},
|
||||
}
|
||||
kb_lib::WsEvent::SubscriptionRegistered {
|
||||
endpoint_name,
|
||||
subscription,
|
||||
} => {
|
||||
format!(
|
||||
"[ws:{endpoint_name}] subscription registered subscribe_method={} unsubscribe_method={} notification_method={} request_id={} subscription_id={}",
|
||||
subscription.subscribe_method,
|
||||
subscription.unsubscribe_method,
|
||||
subscription.notification_method,
|
||||
subscription.request_id,
|
||||
subscription.subscription_id
|
||||
)
|
||||
}
|
||||
kb_lib::WsEvent::SubscriptionNotification {
|
||||
endpoint_name,
|
||||
subscription,
|
||||
notification,
|
||||
method_matches_registry,
|
||||
} => {
|
||||
format!(
|
||||
"[ws:{endpoint_name}] tracked notification method={} expected_method={} matches_registry={} subscription_id={} result={}",
|
||||
notification.method,
|
||||
subscription.notification_method,
|
||||
method_matches_registry,
|
||||
subscription.subscription_id,
|
||||
notification.params.result
|
||||
)
|
||||
}
|
||||
kb_lib::WsEvent::JsonRpcNotificationWithoutSubscription {
|
||||
endpoint_name,
|
||||
notification,
|
||||
} => {
|
||||
format!(
|
||||
"[ws:{endpoint_name}] untracked notification method={} subscription={} result={}",
|
||||
notification.method, notification.params.subscription, notification.params.result
|
||||
)
|
||||
}
|
||||
kb_lib::WsEvent::SubscriptionUnregistered {
|
||||
endpoint_name,
|
||||
subscription_id,
|
||||
unsubscribe_method,
|
||||
was_active,
|
||||
} => {
|
||||
format!(
|
||||
"[ws:{endpoint_name}] subscription unregistered subscription_id={} unsubscribe_method={} was_active={}",
|
||||
subscription_id, unsubscribe_method, was_active
|
||||
)
|
||||
}
|
||||
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,
|
||||
@@ -415,21 +452,18 @@ fn kb_format_ws_event(
|
||||
} => {
|
||||
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