| from kms.models.db_models import * | |
| from db import * | |
| from fastapi import FastAPI, Request, status | |
| from fastapi.exceptions import RequestValidationError | |
| from active.utils.error_handlers import validation_exception_handler | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from channel.socket_api import router as socket_router | |
| # Create two separate FastAPI applications | |
| socket_app = FastAPI(title="WebSocket API") | |
| # CORS setup if needed | |
| # origins = ["http://localhost:3000", "https://rorobot.netlify.app"] | |
| # socket_app.add_middleware( | |
| # CORSMiddleware, | |
| # allow_origins=origins, | |
| # allow_credentials=True, | |
| # allow_methods=["*"], | |
| # allow_headers=["*"], | |
| # ) | |
| # Socket app setup | |
| socket_app.include_router(socket_router) | |
| async def socket_root(): | |
| return {"message": "WebSocket API Server"} | |
| SOCKET_HOST = "localhost" | |
| SOCKET_PORT = 3001 | |
| if __name__ == "__main__": | |
| import uvicorn | |
| uvicorn.run(socket_app, host=SOCKET_HOST, port=SOCKET_PORT) |