2024-03-12 14:05:27 -04:00
|
|
|
using CommonSocketLibrary.Abstract;
|
|
|
|
using CommonSocketLibrary.Common;
|
2024-06-16 20:19:31 -04:00
|
|
|
using Serilog;
|
2024-03-12 14:05:27 -04:00
|
|
|
using TwitchChatTTS.OBS.Socket.Data;
|
|
|
|
|
|
|
|
namespace TwitchChatTTS.OBS.Socket.Handlers
|
|
|
|
{
|
|
|
|
public class IdentifiedHandler : IWebSocketHandler
|
|
|
|
{
|
|
|
|
private ILogger Logger { get; }
|
|
|
|
public int OperationCode { get; set; } = 2;
|
|
|
|
|
2024-06-16 20:19:31 -04:00
|
|
|
public IdentifiedHandler(ILogger logger)
|
|
|
|
{
|
2024-03-12 14:05:27 -04:00
|
|
|
Logger = logger;
|
|
|
|
}
|
|
|
|
|
|
|
|
public async Task Execute<Data>(SocketClient<WebSocketMessage> sender, Data message)
|
|
|
|
{
|
|
|
|
if (message is not IdentifiedMessage obj || obj == null)
|
|
|
|
return;
|
2024-06-16 20:19:31 -04:00
|
|
|
|
2024-03-12 14:05:27 -04:00
|
|
|
sender.Connected = true;
|
2024-06-16 20:19:31 -04:00
|
|
|
Logger.Information("Connected to OBS via rpc version " + obj.NegotiatedRpcVersion + ".");
|
2024-03-12 14:05:27 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|