portal/deps/phoenix_pubsub
Mikael Hugo 35f29f42e3 feat: add flake.nix, .envrc, fix config (runtime.exs), deps compile clean
- flake.nix: Elixir 1.18.4 / OTP 27 / Node 22 dev shell
- .envrc: use flake
- config/config.exs: move fetch_env! to runtime.exs (compile-time safe)
- config/runtime.exs: all secrets loaded at runtime via env vars
- mix.lock: generated after mix deps.get
- All 3 apps compile cleanly

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-09 19:55:48 +02:00
..
lib/phoenix feat: add flake.nix, .envrc, fix config (runtime.exs), deps compile clean 2026-05-09 19:55:48 +02:00
test/shared feat: add flake.nix, .envrc, fix config (runtime.exs), deps compile clean 2026-05-09 19:55:48 +02:00
.hex feat: add flake.nix, .envrc, fix config (runtime.exs), deps compile clean 2026-05-09 19:55:48 +02:00
CHANGELOG.md feat: add flake.nix, .envrc, fix config (runtime.exs), deps compile clean 2026-05-09 19:55:48 +02:00
hex_metadata.config feat: add flake.nix, .envrc, fix config (runtime.exs), deps compile clean 2026-05-09 19:55:48 +02:00
LICENSE.md feat: add flake.nix, .envrc, fix config (runtime.exs), deps compile clean 2026-05-09 19:55:48 +02:00
mix.exs feat: add flake.nix, .envrc, fix config (runtime.exs), deps compile clean 2026-05-09 19:55:48 +02:00
README.md feat: add flake.nix, .envrc, fix config (runtime.exs), deps compile clean 2026-05-09 19:55:48 +02:00

Phoenix.PubSub

Distributed PubSub and Presence platform for the Phoenix Framework

Build Status

Usage

Add phoenix_pubsub to your list of dependencies in mix.exs:

def deps do
  [{:phoenix_pubsub, "~> 2.0"}]
end

Then start your PubSub instance:

defmodule MyApp do
  use Application

  def start(_type, _args) do
    children = [
      {Phoenix.PubSub, name: MyApp.PubSub}
    ]

    opts = [strategy: :one_for_one, name: MyApp.Supervisor]
    Supervisor.start_link(children, opts)
  end
end

Now broadcast and subscribe:

Phoenix.PubSub.subscribe(MyApp.PubSub, "user:123")
Phoenix.PubSub.broadcast(MyApp.PubSub, "user:123", :hello_world)

Testing

Testing by default spawns nodes internally for distributed tests. To run tests that do not require clustering, exclude the clustered tag:

$ mix test --exclude clustered

If you have issues running the clustered tests try running:

$ epmd -daemon

before running the tests.