# `Mead.Deck.Tickets`
[🔗](https://github.com/albertosca/mead/blob/main/lib/mead/deck/tickets.ex#L1)

Single-use tickets that turn an authenticated `POST /deck/ticket` into one WebSocket upgrade.

A ticket is 128 random bits, URL-safe, and lives in a public named ETS table owned by this
process. `consume/2` is `:ets.take/2`, which is atomic, so two sockets presenting the same
ticket at the same instant cannot both win. Expired tickets are refused on consume and swept
periodically so abandoned ones do not accumulate. The ticket is a secret: it is never logged,
and the server state is the table name only, so `:sys.get_state/1` shows none.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `consume`

```elixir
@spec consume(atom(), term()) :: {:ok, String.t()} | :error
```

# `issue`

```elixir
@spec issue(atom(), String.t(), pos_integer()) :: String.t()
```

# `size`

```elixir
@spec size(atom()) :: non_neg_integer()
```

How many tickets are held, expired ones included until the next sweep.

# `start_link`

---

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