-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
subscribed and recieved data in playground
- Loading branch information
Showing
7 changed files
with
29 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
defmodule AshGraphql.Resource.Subscription.DefaultConfig do | ||
def config(_, _), do: dbg({:ok, topic: "*"}) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
defmodule AshGraphq.Resource.Subscription.Notifier do | ||
defmodule AshGraphql.Resource.Subscription.Notifier do | ||
alias AshGraphql.Resource.Info | ||
use Ash.Notifier | ||
|
||
@impl Ash.Notifier | ||
def notify(notification) do | ||
IO.inspect(notification, label: :Notifier) | ||
pub_sub = Info.subscription_pubsub(notification.resource) | ||
|
||
Absinthe.Subscription.publish(AshGraphql.Test.PubSub, notification.data, | ||
subscrible_created: "*" | ||
) | ||
for subscription <- AshGraphql.Resource.Info.subscriptions(notification.resource) do | ||
Absinthe.Subscription.publish(pub_sub, notification.data, [{subscription.name, "*"}]) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters