mirror of
https://github.com/rommapp/romm.git
synced 2025-12-23 19:00:23 +00:00
28 lines
738 B
Python
28 lines
738 B
Python
import socketio # type: ignore
|
|
|
|
from config import REDIS_URL
|
|
from utils import json as json_module
|
|
|
|
|
|
class SocketHandler:
|
|
def __init__(self) -> None:
|
|
self.socket_server = socketio.AsyncServer(
|
|
cors_allowed_origins="*",
|
|
async_mode="asgi",
|
|
json=json_module,
|
|
logger=False,
|
|
engineio_logger=False,
|
|
client_manager=socketio.AsyncRedisManager(str(REDIS_URL)),
|
|
ping_timeout=60,
|
|
ping_interval=25,
|
|
max_http_buffer_size=1e6, # 1MB
|
|
cors_credentials=True,
|
|
)
|
|
|
|
self.socket_app = socketio.ASGIApp(
|
|
self.socket_server, socketio_path="/ws/socket.io"
|
|
)
|
|
|
|
|
|
socket_handler = SocketHandler()
|