diff --git a/osinaweb/support/__pycache__/consumers.cpython-310.pyc b/osinaweb/support/__pycache__/consumers.cpython-310.pyc index e710e6e8..0403e82e 100644 Binary files a/osinaweb/support/__pycache__/consumers.cpython-310.pyc and b/osinaweb/support/__pycache__/consumers.cpython-310.pyc differ diff --git a/osinaweb/support/consumers.py b/osinaweb/support/consumers.py index 3ed706db..c9ff5888 100644 --- a/osinaweb/support/consumers.py +++ b/osinaweb/support/consumers.py @@ -180,16 +180,27 @@ class TicketRoomConsumer(WebsocketConsumer): ) def user_connection_handler(self, event): - context = { - 'connections': event['connections'], - 'user': event['user'] - } - html = render_to_string("details_templates/partials/ticket-online-users.html", context=context) - self.send(text_data=json.dumps({ - 'event_type': 'useer_status', - 'html': html - })) + try: + connections = event.get('connections') + user = event.get('user') + + if connections is None or user is None: + raise ValueError("Event data missing 'connections' or 'user'") + context = { + 'connections': connections, + 'user': user + } + html = render_to_string("details_templates/partials/ticket-online-users.html", context=context) + self.send(text_data=json.dumps({ + 'event_type': 'user_status', + 'html': html + })) + except Exception as e: + self.send(text_data=json.dumps({ + 'event_type': 'error', + 'message': str(e) + }))