Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I think this is might be what I’m looking for.
Let’s say my GQL sub is something like:
Right now, my withFilter resolver might look like this:
That’s pretty cool, but this means that every subscriber to
messageAdded
will get a message and then filter for whether to publish to client based on themyFilter
function. Not very scalable :/The most obvious way to fix this to me is to publish more distinct topics:
Now
pubsub.publish
will publish something likemessageAdded.1
for a message added to Group 1, and only users subscribed tomessageAdded.1
will receive the message and run it throughmyFilter
. But currentlyasyncIteratorFn
doesn't have access to theargs
,context
, etc to make distinct topic(s) likemessageAdded.1
So while this fix is a small bit of code, I think it could make
withFilter
a much more scalable helper function :)