diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3 index e1f5dba1..511dea1b 100644 Binary files a/osinaweb/db.sqlite3 and b/osinaweb/db.sqlite3 differ diff --git a/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc b/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc index 5a5cd26e..25b584d0 100644 Binary files a/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc and b/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc differ diff --git a/osinaweb/osichat/consumers.py b/osinaweb/osichat/consumers.py index 307b51d7..93ad9ef1 100644 --- a/osinaweb/osichat/consumers.py +++ b/osinaweb/osichat/consumers.py @@ -5,28 +5,12 @@ from django.template.loader import render_to_string from asgiref.sync import async_to_sync from django.shortcuts import get_object_or_404 import requests -from django.contrib.sessions.models import Session class OsitcomVisitor(WebsocketConsumer): def connect(self): - cookie_header = dict(self.scope.get('headers', {})).get(b'cookie', b'').decode('utf-8') - - self.session_id = None - if cookie_header: - for cookie in cookie_header.split('; '): - key, value = cookie.split('=', 1) - if key == 'sessionid': - self.session_id = value - break - - if not self.session_id: - self.session_id = self.scope.get('session', {}).get('_session_key') - - if not self.session_id: - # Handle missing session_id scenario, maybe reject the connection - self.close() - return + session = self.scope["session"] + self.session_id = session.session_key async_to_sync(self.channel_layer.group_add)( 'ositcom_visitors', self.channel_name ) diff --git a/osinaweb/static/js/osichat/conversation.js b/osinaweb/static/js/osichat/conversation.js index 90d8fe96..1508ba06 100644 --- a/osinaweb/static/js/osichat/conversation.js +++ b/osinaweb/static/js/osichat/conversation.js @@ -1,6 +1,6 @@ const chat_ws_scheme = window.location.protocol === "https:" ? "wss" : "ws"; -const domain = "192.168.1.111:8000"; +const domain = "192.168.1.106:8000"; const osichatSocketUrl = `${chat_ws_scheme}://${domain}/ws/osichat/`; const osichatSocket = new WebSocket(osichatSocketUrl);