Update files
This commit is contained in:
parent
b496757cd5
commit
7fadcf4f53
|
|
@ -107,11 +107,24 @@ class SocketIOWrapper:
|
||||||
|
|
||||||
async def __call__(self, scope, receive, send):
|
async def __call__(self, scope, receive, send):
|
||||||
path = scope.get("path", "")
|
path = scope.get("path", "")
|
||||||
# Если путь начинается с /socket.io, используем Socket.IO
|
scope_type = scope.get("type", "")
|
||||||
if path.startswith("/socket.io"):
|
|
||||||
|
# Логируем для отладки
|
||||||
|
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)
|
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:
|
else:
|
||||||
# Иначе используем FastAPI
|
# Иначе используем FastAPI
|
||||||
|
print(f"[SocketIOWrapper] → Routing to FastAPI: type={scope_type}, path={path}")
|
||||||
await self.fastapi_app(scope, receive, send)
|
await self.fastapi_app(scope, receive, send)
|
||||||
|
|
||||||
# Создаем обернутое приложение (доступно для uvicorn)
|
# Создаем обернутое приложение (доступно для uvicorn)
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,8 @@ server {
|
||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
}
|
}
|
||||||
|
|
||||||
# WebSocket для чата модераторов
|
# WebSocket для Socket.IO (чат модераторов)
|
||||||
location /mod-chat {
|
location /socket.io/ {
|
||||||
proxy_pass http://127.0.0.1:3001;
|
proxy_pass http://127.0.0.1:3001;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue