fastapi-socketio icon indicating copy to clipboard operation
fastapi-socketio copied to clipboard

How it works with real example (with bigger project structure)?

Open michaldev opened this issue 2 years ago • 2 comments
trafficstars

In my case, I have problem with import everything from main file (with fastapi app object). https://github.com/michaldev/problem-with-fastapi-import

Access to the app object is not required for other libraries.

michaldev avatar Dec 13 '22 23:12 michaldev

I try like this: main.py: socket_manager.attach(app=app) sockets.py: socket_manager = SocketManager(app=None)

by returns AttributeError: 'NoneType' object has no attribute 'mount'

michaldev avatar Dec 20 '22 11:12 michaldev

Solved. I used python-socketio instead of fastapi-socketio and I was able to connect a manager from main that is in a different file. This prevents circular imports.

michaldev avatar Dec 20 '22 13:12 michaldev