# `GoodJob.PubSub`
[🔗](https://github.com/amkisko/good_job.ex/blob/v1.0.0/lib/good_job/pubsub.ex#L1)

Broadcasts job events to Phoenix.PubSub for real-time LiveView updates.

This allows LiveViews to subscribe to job events and update automatically
when jobs are created, updated, or completed.

**Note:** This module is optional and requires Phoenix to be available.
If Phoenix is not available, all functions will gracefully no-op.
The core GoodJob library works perfectly fine without Phoenix.

# `broadcast`

Broadcasts a job event to all subscribers.

Events:
- `:job_created` - A new job was enqueued
- `:job_updated` - A job's state changed (e.g., started running)
- `:job_completed` - A job finished (succeeded or discarded)
- `:job_deleted` - A job was deleted
- `:job_retried` - A job was retried
- `:job_discarded` - A job was discarded

Returns `:ok` if broadcast succeeded, `:noop` if Phoenix is not available.

# `subscribe`

Subscribes to job events.

Returns the topic name for use in LiveView subscriptions, or `nil` if Phoenix is not available.

---

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