Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invert the instructions for installing subscriptions with phoenix. #1125

Merged
merged 2 commits into from
Nov 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions guides/subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,7 @@ In your application supervisor add a line _after_ your existing endpoint supervi
line:

```elixir
[
# other children ...
supervisor(MyAppWeb.Endpoint, []), # this line should already exist
supervisor(Absinthe.Subscription, MyAppWeb.Endpoint), # add this line
# other children ...
]
```

In Phoenix v1.4, the supervisor children are mounted like so:

```elixir
# List all child processes to be supervised
# List all child processes to be supervised
children = [
# Start the Ecto repository
MyAppWeb.Repo,
Expand All @@ -52,7 +41,19 @@ In Phoenix v1.4, the supervisor children are mounted like so:
# for other strategies and supported options
opts = [strategy: :one_for_one, name: MyAppWeb.Supervisor]
Supervisor.start_link(children, opts)
```

In older versions of phoenix (pre 1.4) you might see a slightly different syntax,
in which case add Absinthe like this:

```elixir
[
# other children ...
MyAppWeb.Repo,
supervisor(MyAppWeb.Endpoint, []), # this line should already exist
supervisor(Absinthe.Subscription, MyAppWeb.Endpoint), # add this line
# other children ...
]
```

Where `MyAppWeb.Endpoint` is the name of your application's phoenix endpoint.
Expand Down