barnabasJ

barnabasJ

Ash Core Team

I’m trying to add support for subscriptions to AshGraphql and I got a simple subscription working but now I’m a bit stuck.

So far I have added a way to add a new subscription and closed the loop by providing the needed notifications and resolver.

But so far it just works for plain subscriptions without some arguments.

e.g.

subscription {
  bucketCreated {
    id
    name
  }
}

What I’m trying to do is make it possible to add a filter argument to the subscription to allow the subscriber to select which resources he wants to be notified about.

Something like this

subscription {
  bucketCreated(filter: {name: {eq: "test}}}) {
    id
    name
  }
}

Now, I’m a bit stuck on how to configure the topics/context_ids. The problem is at the time a subscription is created, I could potentially serialize the filter and use it as the topic, but then I don’t really have a good way to notify the subscription when a change occurs because there are too many possible filters.

On the other hand, if I use a generic topic, the resolver is called for all the subscriptions. In the resolver, I could potentially check if the resource that triggered the change matches the filter and return in that case, but at that point, I haven’t found a way to stop the resolution without returning a value.

Another thing I looked at was if there was a way to see what subscriptions are currently active in the trigger and use that information to trigger the respective topics, but I also didn’t find a way to do this.

Does someone know of a way to achieve this?

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
jaybe78
Hello, I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter). The diffic...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews