# `Volt.HMR`
[🔗](https://github.com/elixir-volt/volt/blob/v0.16.0/lib/volt/hmr.ex#L1)

Public helpers for broadcasting Volt HMR messages.

These functions are intended for packages that compose Volt's dev server but
own additional source graphs, such as static-site generators. They expose the
same websocket protocol used internally by `Volt.Watcher` without requiring
callers to reach into Volt's registry implementation.

# `broadcast`

```elixir
@spec broadcast(:update | :error | :ping | :pong, term()) :: :ok
```

Broadcast an HMR message to all connected clients.

# `error`

```elixir
@spec error(String.t(), term()) :: :ok
```

Broadcast an error payload for a source path.

# `full_reload`

```elixir
@spec full_reload(String.t()) :: :ok
```

Broadcast a full page reload request for a changed path.

# `invalidate_file`

```elixir
@spec invalidate_file(String.t()) :: :ok
```

Invalidate Volt's dev compilation state for a source file without broadcasting.

# `style_update`

```elixir
@spec style_update(String.t()) :: :ok
```

Broadcast a style-only update for a changed stylesheet path.

# `update`

```elixir
@spec update(String.t(), [atom() | String.t()], keyword()) :: :ok
```

Broadcast an update for a changed path.

---

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