mirror of
https://github.com/w-okada/voice-changer.git
synced 2025-01-23 13:35:12 +03:00
20 lines
627 B
Python
20 lines
627 B
Python
import socketio
|
|
|
|
from sio.MMVC_Namespace import MMVC_Namespace
|
|
from voice_changer.VoiceChangerManager import VoiceChangerManager
|
|
|
|
|
|
class MMVC_SocketIOServer:
|
|
_instance: socketio.AsyncServer | None = None
|
|
|
|
@classmethod
|
|
def get_instance(cls, voiceChangerManager: VoiceChangerManager):
|
|
if cls._instance is None:
|
|
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
|