-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Rewrite GraphQL subscriptions to Django Channels and use Load B…
…alancer to handle websocket connections (#488) * Use django channels for graphql subscriptions * Configure redis as django channels layers backend * Add redis configuration for channels layers and implement authentication middleware * Show error when one tries to use permission_checker decorator on a Subscription class * Change gunicorn worker class to uvicorn to support ASGI app. * Delete wsgi.py * Update backend and frontend tests * Add missing redis cluster to AWS infra * Make sure we use wss protocol in AWS * Fix CF distribution to handle websockets * Move scripts from package.json to project.json to avoid issues with env variables passing * Fix docs deployment * Fix failing tests and build steps * Reconnect websockets after user logs into the app. * Fix sonar-project properties
- Loading branch information
1 parent
6067b41
commit e13baf4
Showing
76 changed files
with
1,316 additions
and
2,089 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
from django.db.models.signals import post_save | ||
from django.dispatch import receiver | ||
|
||
from apps.websockets import utils | ||
from . import models, constants | ||
from . import models, schema | ||
|
||
|
||
@receiver(post_save, sender=models.Notification) | ||
def notify_about_entry(sender, instance: models.Notification, created, update_fields, **kwargs): | ||
if created: | ||
utils.send_subscriptions_messages( | ||
instance.user, constants.Subscription.NOTIFICATIONS_LIST_SUBSCRIPTION.value, root_value=[instance] | ||
) | ||
schema.NotificationCreatedSubscription.broadcast(payload={'id': str(instance.id)}, group=str(instance.user.id)) |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import channels_graphql_ws | ||
|
||
from config.schema import schema as graphql_schema | ||
|
||
|
||
class DefaultGraphqlWsConsumer(channels_graphql_ws.GraphqlWsConsumer): | ||
"""Channels WebSocket consumer which provides GraphQL API.""" | ||
|
||
schema = graphql_schema |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.