# http/ws-connect Connect to a WebSocket server (`ws://` or `wss://`). ## Syntax
[http/ws-connect $url ?$opts]
## Parameters - `$url` — `ws://host[:port]/path` or `wss://host[:port]/path` - `$opts` — optional map: `:on-message` fn, `:on-close` fn, `:headers` map ## Examples
set fut [http/ws-connect "wss://echo.example.com" %{
  :on-message {|msg| echo $msg~data }
}]
set conn [await $fut]
[http/ws-send $conn "hello"]
## Returns Future of a `ws_conn` resource. `await` it to get the connection. ## See Also `http/ws-server`, `http/ws-send`, `await`