"""
This file contains the ChatSocketManager class, which is used to manage chat sessions.
"""

import socketio
from namespaces.doc_chat import ChatNamespace


# -----------------------------
# Socket Manager Class
# -----------------------------
class SocketManager:
    def __init__(self, redis_client):
        # Create an asynchronous Socket.IO server (using ASGI mode)
        self.sio = socketio.AsyncServer(
            async_mode="asgi",
            cors_allowed_origins=[],
            allow_credentials=True,
            logger=True,
        )
        self.redis_client = redis_client
        self.sio.register_namespace(ChatNamespace("/doc/chat", redis_client))
