Update files

This commit is contained in:
glpshchn 2025-12-15 04:25:31 +03:00
parent b496757cd5
commit 7fadcf4f53
2 changed files with 18 additions and 5 deletions

View File

@ -107,11 +107,24 @@ class SocketIOWrapper:
async def __call__(self, scope, receive, send):
path = scope.get("path", "")
# Если путь начинается с /socket.io, используем Socket.IO
if path.startswith("/socket.io"):
await self.socketio_app(scope, receive, send)
scope_type = scope.get("type", "")
# Логируем для отладки
print(f"[SocketIOWrapper] Request: type={scope_type}, path={path}, method={scope.get('method', 'N/A')}")
# Если это WebSocket или путь начинается с /socket.io, используем Socket.IO
if scope_type == "websocket" or path.startswith("/socket.io"):
print(f"[SocketIOWrapper] ✅ Routing to Socket.IO: type={scope_type}, path={path}")
try:
await self.socketio_app(scope, receive, send)
except Exception as e:
print(f"[SocketIOWrapper] ❌ Error in Socket.IO: {e}")
import traceback
traceback.print_exc()
raise
else:
# Иначе используем FastAPI
print(f"[SocketIOWrapper] → Routing to FastAPI: type={scope_type}, path={path}")
await self.fastapi_app(scope, receive, send)
# Создаем обернутое приложение (доступно для uvicorn)

View File

@ -86,8 +86,8 @@ server {
proxy_buffering off;
}
# WebSocket для чата модераторов
location /mod-chat {
# WebSocket для Socket.IO (чат модераторов)
location /socket.io/ {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;