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