using System.Text.Json; using CommonSocketLibrary.Abstract; using HermesSocketServer.Socket.Handlers; using ILogger = Serilog.ILogger; namespace HermesSocketServer.Socket { public class SocketHandlerManager : HandlerManager { private readonly HermesSocketManager _sockets; private readonly IServiceProvider _serviceProvider; public SocketHandlerManager(HermesSocketManager sockets, IServiceProvider serviceProvider, ILogger logger) : base(logger) { _sockets = sockets; _serviceProvider = serviceProvider; Add(0, _serviceProvider.GetRequiredKeyedService("hermes-heartbeat")); Add(1, _serviceProvider.GetRequiredKeyedService("hermes-hermeslogin")); Add(3, _serviceProvider.GetRequiredKeyedService("hermes-request")); Add(5, _serviceProvider.GetRequiredKeyedService("hermes-error")); Add(6, _serviceProvider.GetRequiredKeyedService("hermes-chatter")); Add(7, _serviceProvider.GetRequiredKeyedService("hermes-emotedetails")); Add(8, _serviceProvider.GetRequiredKeyedService("hermes-emoteusage")); } protected override async Task Execute(WebSocketUser sender, ISocketHandler handler, T value) { await handler.Execute(sender, value, _sockets); } } }