# `XGW.Application`
[🔗](https://github.com/Lazarus404/xgw/blob/main/lib/xgw/application.ex#L1)

OTP application entry for XGW.

On boot this module:

1. Loads the patched OTP DTLS packet demux (`XGW.DTLS.OtpDemux`) so DTLS can
   send on the shared Listener UDP socket instead of a private `:gen_udp`.
2. Ensures the `XGW.Peer.SendHandle` and `XGW.Peer.Datachannel` ETS tables exist
   (RTP hot path and DC child lookup).
3. Starts a `DynamicSupervisor` (`XGW.PeerSupervisor`) that owns `XGW.Peer`
   processes.

Listeners are started by the host (your app, the browser spike, or tests),
not here.

## RFCs

Bootstraps OTP pieces used by the stack above (no wire-protocol role of its own).
DTLS demux patch supports the RFC 7983 shared-socket model.

# `start`

Starts the XGW supervision tree.

Always returns `{:ok, pid}` of the root supervisor when children start cleanly.

---

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