Fix WebSocket URL: add /websocket suffix for Phoenix Channels
This commit is contained in:
parent
cc0e250a88
commit
5f39f748a9
1 changed files with 3 additions and 1 deletions
|
|
@ -3,6 +3,8 @@
|
|||
/// This replaces the complex REST API + polling architecture with a single
|
||||
/// persistent WebSocket connection. The server sends SNMP query jobs as protobuf
|
||||
/// messages, the agent executes raw SNMP queries, and sends results back.
|
||||
///
|
||||
/// Connection URL: {url}/socket/agent/websocket?token={token}
|
||||
use anyhow::{Context, Result};
|
||||
use base64::engine::general_purpose::STANDARD as BASE64;
|
||||
use base64::Engine;
|
||||
|
|
@ -49,7 +51,7 @@ impl AgentClient {
|
|||
/// let client = AgentClient::connect("wss://towerops.net", "token123").await?;
|
||||
/// ```
|
||||
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/websocket?token={}", url, token);
|
||||
log::info!("Connecting to WebSocket: {}", ws_url);
|
||||
|
||||
let (mut ws_stream, _) = connect_async(&ws_url)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue