Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

WsClient::new

Construct a WsClient from a ws:// or wss:// URL.

Signature

pub fn new(url: impl Into<String>) -> Result<Self, anyhow::Error>;

Example

use {anyhow::Result, dango_sdk::WsClient};
 
fn main() -> Result<()> {
    let client = WsClient::new("wss://api-mainnet.dango.zone/graphql")?;
    let _ = client;
    Ok(())
}

Parameters

urlimpl Into<String>. A WebSocket URL. Must begin with ws:// or wss://.

Returns

WsClient — a cheap config holder. No network call is performed.

Notes

  • Returns Err(anyhow!("Invalid URL scheme: …")) for any non-WebSocket scheme.
  • Returns a url::ParseError (wrapped) when the URL is malformed.

See also

  • from_http_url — accept http:// / https:// and rewrite the scheme.
  • connect — open a connection.