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

Ability to customize topic/trigger sbscribed to at subscription initialization time? #41

Open
jhanschoo opened this issue Sep 29, 2018 · 1 comment

Comments

@jhanschoo
Copy link

Currently, subscriptions topics seem to be determined by the GraphQL API. Controllers filter messages published to the GraphQL API-determined topic. This does not scale well in certain situations.

Consider a chatroom server, where users may create rooms and subscribe to those rooms, passing the room id as a parameter. Then by the example, the publisher must publish to ALL chatrooms, and the subscription controller filters by chatroom. This is not ideal in, say, redis implementations, since publishing is O(n) in the number of topic subscribers. The ideal way is to be able to determine which topic to subscribe to as controller. (As well as implement a filtering function)

@jhanschoo
Copy link
Author

It seems like this is the line that needs to be changed.

subscribe: withFilter(() => this.options.subscriptionAsyncIterator(action.name || action.methodName), function (playload: any, args: any, context: any, info: any) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant