-
-
Notifications
You must be signed in to change notification settings - Fork 627
Closed
Description
I have used python-socketio with FastAPI & Uvicorn as server, But when I try to connect to socket using the below mentioned URL getting 403 as response
Dependency:
python-engineio 3.14.2
python-socketio 4.6.1
uvicorn 0.22.0
fastapi 0.97.0
URL to connect: ws://localhost:5050/ws
Code:
import uvicorn
from engineio import ASGIApp
from fastapi import FastAPI
from socketio import AsyncServer
app = FastAPI(title=__name__)
sio = AsyncServer(async_mode="asgi", cors_allowed_origins="*", always_connect=True)
socket_app = ASGIApp(sio, other_asgi_app=app)
app.mount(path='/ws', app=socket_app, name="SocketServer")
if __name__ == "__main__":
uvicorn.run(
"__main__:app",
host="0.0.0.0",
port=5050,
reload=False
)
Response
Error: Unexpected server response: 403
Metadata
Metadata
Assignees
Labels
No labels