Skip to content

Commit

Permalink
temporary
Browse files Browse the repository at this point in the history
  • Loading branch information
amadolid committed Aug 14, 2023
1 parent 7e11762 commit 38fe076
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
10 changes: 0 additions & 10 deletions jaseci_serv/jaseci_serv/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,6 @@

ASGI_APPLICATION = "jaseci_serv.asgi.application"

CHANNEL_LAYERS = {
"default": {
# "BACKEND": "channels.layers.InMemoryChannelLayer",
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [("localhost", 6379)],
},
},
}

# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases

Expand Down
21 changes: 21 additions & 0 deletions jaseci_serv/jaseci_serv/socket/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from channels.generic.websocket import WebsocketConsumer
from asgiref.sync import async_to_sync
from uuid import uuid4
from jaseci_serv.base.models import lookup_global_config
from channels.layers import settings


class SocketConsumer(WebsocketConsumer):
Expand Down Expand Up @@ -42,3 +44,22 @@ def receive(self, text_data=None, bytes_data=None):

def notify(self, data):
self.send(text_data=dumps(data))


setattr(
settings,
"CHANNEL_LAYERS",
{
"default": loads(
lookup_global_config(
"CHANNEL_LAYER",
{
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [("localhost", 6379)],
},
},
)
)
},
)

0 comments on commit 38fe076

Please sign in to comment.