Elixir absinthe send subscription to other users(no the one that triggered the event)?

As the title say, is it possible to send a subscription to every user but the one that triggered the subscription.


type Comment{
  id: ID!
  user_id: ID!
Subscription {
  commentAdded: Comment

So when filtering the subscriptions to send I would just compare the comment.user_id with the ctx.user_id.
But I can’t find a way to make it working with the config topic

config fn args, ctx ->
   {:ok, topic: ???}

Should I put this kind of logic somewhere else?

config is just to setup a topic. You need trigger notation to set who should receive notification

config(fn _args, ctx -> {:ok, topic: ctx.user_id} end)
trigger(:create_comment, topic: fn comment ->
   Enum.reject(all_users_ids, & &1 == comment.user_id)

but, probably you don’t need this feature. It is ok to send subscription to comment author to refresh data in all open tabs.


Thanks for the answer

Yeah probably I should handle the duplication of data on the client (because I update apollo cache after mutation and with the subscription) but this could be handy anyway