You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.
I'm hitting a 403 locally. Been trying to debug for days.
from flask_socketio import SocketIO
from flask_cors import CORS
from fastapi import FastAPI, WebSocket, Depends
from fastapi_socketio import SocketManager
from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
I'm hitting a 403 locally. Been trying to debug for days.
from flask_socketio import SocketIO
from flask_cors import CORS
from fastapi import FastAPI, WebSocket, Depends
from fastapi_socketio import SocketManager
from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
app = FastAPI()
app.mount("/static", StaticFiles(directory="front/build", html=True), name="static")
socket_manager = SocketManager(app=app)
Set CORS
origins = [
"http://localhost:3000"
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=[""],
allow_headers=[""],
)
GAME_NAMESPACE = "/game"
if name == "main":
# LOCAL
port = int(os.environ.get("PORT", 5001))
import uvicorn
uvicorn.run(app, host="127.0.0.1", port=port, log_level="info")
On Client:
const SERVER_URL = 'http://127.0.0.1:5001';
const GAME_NAMESPACE = '/game';
To run locally I'm using:
uvicorn server:app --reload --port 5001.
ERRORS:
WebSocket connection to 'ws://127.0.0.1:5001/socket.io/?EIO=4&transport=websocket' failed
INFO: ('127.0.0.1', 51879) - "WebSocket /socket.io/?EIO=4&transport=websocket" 403
INFO: connection failed (403 Forbidden)
INFO: connection closed
Any ideas?
The text was updated successfully, but these errors were encountered: