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,