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 was archived by the owner on Apr 4, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 4, 2024. It is now read-only.
@app.sio.on('join')
async def handle_join(sid, *args, **kwargs):
await app.sio.emit('lobby', 'User joined')
@app.sio.event
async def connect(sid, environ):
print(f"client {sid} has connected to the server")
`
i want to run my socketio on my /socket.io route is it possible via this module, since mounting the normal socket.io to fastapi results in a 404 route not found.
I proceeded to just use normal python-socketio with fastapi where i had my setup like: app = FastAPI() sio = socketio.AsyncServer(async_mode='asgi', json=BaseModelJSON, cors_allowed_origins=[], namespaces=["*"], **kwargs) asgi = socketio.ASGIApp(socketio_server=self.sio, socketio_path="/") app.mount("/socket.io", asgi)
My Problem was that i mounted as "/socket.io" and my socketio_path was also "/socket.io" so my routes weren't found
Activity
BuckLearnsCode commentedon Oct 26, 2023
Did you ever figure out how to solve this?
lrosch commentedon Oct 26, 2023
I proceeded to just use normal python-socketio with fastapi where i had my setup like:
app = FastAPI() sio = socketio.AsyncServer(async_mode='asgi', json=BaseModelJSON, cors_allowed_origins=[], namespaces=["*"], **kwargs) asgi = socketio.ASGIApp(socketio_server=self.sio, socketio_path="/") app.mount("/socket.io", asgi)My Problem was that i mounted as "/socket.io" and my socketio_path was also "/socket.io" so my routes weren't found
Artucuno commentedon Nov 26, 2023
Not sure if you still need help with this, but #50 fixes this issue.
@BuckLearnsCode @lrosch