# `FireMQ.URL`
[🔗](https://github.com/FireMQ/firemq-elixir/blob/v0.1.0/lib/firemq/url.ex#L1)

Parses connection URLs.

    fire://user:password@host:5673/vhost

The schemes are `fire` (TCP, port 5673), `fires` (TLS, port 5674), `ws` (port 15672)
and `wss` (port 15671). User and password default to `guest`. For `fire` and `fires`
the vhost is the path without its leading `/`, percent-decoded; an empty path means
vhost `/`. For `ws` and `wss` the path is the WebSocket endpoint (`/fire` when empty)
and the vhost is the `vhost` query parameter.

This client connects over `fire` and `fires`. WebSocket URLs parse, but `FireMQ.connect/2`
rejects them.

# `t`

```elixir
@type t() :: %FireMQ.URL{
  host: String.t(),
  pass: String.t(),
  path: String.t(),
  port: :inet.port_number(),
  transport: transport(),
  user: String.t(),
  vhost: String.t()
}
```

# `transport`

```elixir
@type transport() :: :tcp | :tls | :ws | :wss
```

# `parse`

```elixir
@spec parse(String.t()) :: {:ok, t()} | {:error, FireMQ.Error.t()}
```

Parses a URL and fills in the defaults.

    iex> {:ok, url} = FireMQ.URL.parse("fire://localhost")
    iex> {url.transport, url.port, url.vhost, url.user}
    {:tcp, 5673, "/", "guest"}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
