WIP: Allow users to control which groups a client is added to#7
Open
jaydenwindle wants to merge 10 commits intomasterfrom
Open
WIP: Allow users to control which groups a client is added to#7jaydenwindle wants to merge 10 commits intomasterfrom
jaydenwindle wants to merge 10 commits intomasterfrom
Conversation
Open
Suor
reviewed
Apr 16, 2020
| subscription = await subscribe(query) | ||
|
|
||
| subscription = """ | ||
| await asyncio.sleep(0.01) |
There was a problem hiding this comment.
Why do we need it? It looks like we didn't need before.
|
@jaydenwindle Will this get released any soon? This will come handy in a project I am working on. |
Owner
Author
|
Hey @oldani! Yes, I'm planning to merge this PR and release v2 as soon as I get a chance to write a v1 -> v2 migration guide for the docs, since there are several breaking changes. I've been a bit busy with other projects recently so haven't had time to finish it. If you'd like to help with the migration guide I'd definitely accept a PR! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR fixes #6 by allowing users to manually control which Channel Layers groups a subscribed client is added to, and which groups subscription events are broadcast over.
The consumer instance is now passed to each subscription resolver as a the
rootvalue, and exposes a function calledsubscribe. When called, this function will add the currently connected client to the specified group and return anObservableof all values sent to that group.A model mixin called
SubscriptionModelMixinhas been created, which usesdjango-lifecycleinstead of Django signals to automatically trigger subscription events when model instances are created, updated, or deleted.This PR also removes the legacy
SubscriptionEventandModelSubscriptionEventclasses, and removes the defaultpost_save_subscriptionandpost_delete_subscriptionsignal handlers, as they are no longer used.Example:
This PR also fixes #8 and #2.