From 3fa722c8f48f5665f114e4d796e6fd6f2e486ff2 Mon Sep 17 00:00:00 2001 From: zuisong Date: Tue, 12 Dec 2023 20:56:14 +0800 Subject: [PATCH] rename host to virtualhost --- src/client.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/client.rs b/src/client.rs index fc3fe7d..ddfb1c0 100644 --- a/src/client.rs +++ b/src/client.rs @@ -14,28 +14,32 @@ use anyhow::{anyhow, bail}; /// Connect to a STOMP server via TCP, including the connection handshake. /// If successful, returns a tuple of a message stream and a sender, /// which may be used to receive and send messages respectively. +/// +/// `virtualhost` If no specific virtualhost is desired, it is recommended +/// to set this to the same as the host name that the socket +/// was established against (i.e, the same as the server address). pub async fn connect( server: impl tokio::net::ToSocketAddrs, - host: impl Into, + virtualhost: impl Into, login: Option, passcode: Option, ) -> Result { let tcp = TcpStream::connect(server).await?; let mut transport = ClientCodec.framed(tcp); - client_handshake(&mut transport, host.into(), login, passcode).await?; + client_handshake(&mut transport, virtualhost.into(), login, passcode).await?; Ok(transport) } async fn client_handshake( transport: &mut ClientTransport, - host: String, + virtualhost: String, login: Option, passcode: Option, ) -> Result<()> { let connect = Message { content: ToServer::Connect { accept_version: "1.2".into(), - host, + host: virtualhost, login, passcode, heartbeat: None,