Skip to content

Commit b915d74

Browse files
Remove fastapi-socketio dependency, doesn't really do much for us and… (#4552)
* Remove fastapi-socketio dependency, doesn't really do much for us and isn't well maintained * Run python black * Remove fastapi_socketio import * Add __app as class variable in case we ever need it later * Run isort --------- Co-authored-by: psychedelicious <[email protected]>
1 parent 6ec347b commit b915d74

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

invokeai/app/api/sockets.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
from fastapi import FastAPI
44
from fastapi_events.handlers.local import local_handler
55
from fastapi_events.typing import Event
6-
from fastapi_socketio import SocketManager
6+
from socketio import ASGIApp, AsyncServer
77

88
from ..services.events import EventServiceBase
99

1010

1111
class SocketIO:
12-
__sio: SocketManager
12+
__sio: AsyncServer
13+
__app: ASGIApp
1314

1415
def __init__(self, app: FastAPI):
15-
self.__sio = SocketManager(app=app)
16+
self.__sio = AsyncServer(async_mode="asgi", cors_allowed_origins="*")
17+
self.__app = ASGIApp(socketio_server=self.__sio, socketio_path="socket.io")
18+
app.mount("/ws", self.__app)
1619

1720
self.__sio.on("subscribe_queue", handler=self._handle_sub_queue)
1821
self.__sio.on("unsubscribe_queue", handler=self._handle_unsub_queue)

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ dependencies = [
4848
"facexlib",
4949
"fastapi==0.88.0",
5050
"fastapi-events==0.8.0",
51-
"fastapi-socketio==0.0.10",
5251
"huggingface-hub~=0.16.4",
5352
"invisible-watermark~=0.2.0", # needed to install SDXL base and refiner using their repo_ids
5453
"matplotlib", # needed for plotting of Penner easing functions

0 commit comments

Comments
 (0)