voice-changer/server/sio/MMVC_SocketIOServer.py

21 lines
643 B
Python
Raw Normal View History

2022-12-31 10:27:18 +03:00
import socketio
from sio.MMVC_Namespace import MMVC_Namespace
from voice_changer.VoiceChangerManager import VoiceChangerManager
class MMVC_SocketIOServer():
@classmethod
def get_instance(cls, voiceChangerManager:VoiceChangerManager):
if not hasattr(cls, "_instance"):
sio = socketio.AsyncServer(
async_mode='asgi',
cors_allowed_origins='*'
)
namespace = MMVC_Namespace.get_instance(voiceChangerManager)
sio.register_namespace(namespace)
cls._instance = sio
return cls._instance
return cls._instance