Add detailed WebSocket connection error logging
This commit is contained in:
parent
b57c6ee3ec
commit
13e45febce
1 changed files with 6 additions and 0 deletions
|
|
@ -50,8 +50,14 @@ impl AgentClient {
|
||||||
/// ```
|
/// ```
|
||||||
pub async fn connect(url: &str, token: &str) -> Result<Self> {
|
pub async fn connect(url: &str, token: &str) -> Result<Self> {
|
||||||
let ws_url = format!("{}/socket/agent?token={}", url, token);
|
let ws_url = format!("{}/socket/agent?token={}", url, token);
|
||||||
|
log::info!("Connecting to WebSocket: {}", ws_url);
|
||||||
|
|
||||||
let (ws_stream, _) = connect_async(&ws_url)
|
let (ws_stream, _) = connect_async(&ws_url)
|
||||||
.await
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
|
log::error!("WebSocket connection failed: {}", e);
|
||||||
|
e
|
||||||
|
})
|
||||||
.context("Failed to connect to WebSocket")?;
|
.context("Failed to connect to WebSocket")?;
|
||||||
|
|
||||||
log::info!("Connected to Towerops server at {}", url);
|
log::info!("Connected to Towerops server at {}", url);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue