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.Seven.Socket.Data;
|
|
|
|
|
|
|
|
namespace TwitchChatTTS.Seven.Socket.Handlers
|
|
|
|
{
|
|
|
|
public class SevenHelloHandler : IWebSocketHandler
|
|
|
|
{
|
|
|
|
private ILogger Logger { get; }
|
2024-03-15 08:27:35 -04:00
|
|
|
private Configuration Configuration { get; }
|
2024-03-12 14:05:27 -04:00
|
|
|
public int OperationCode { get; set; } = 1;
|
|
|
|
|
2024-06-16 20:19:31 -04:00
|
|
|
public SevenHelloHandler(ILogger logger, Configuration configuration)
|
|
|
|
{
|
2024-03-12 14:05:27 -04:00
|
|
|
Logger = logger;
|
2024-03-15 08:27:35 -04:00
|
|
|
Configuration = configuration;
|
2024-03-12 14:05:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public async Task Execute<Data>(SocketClient<WebSocketMessage> sender, Data message)
|
|
|
|
{
|
|
|
|
if (message is not SevenHelloMessage obj || obj == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (sender is not SevenSocketClient seven || seven == null)
|
|
|
|
return;
|
2024-06-16 20:19:31 -04:00
|
|
|
|
2024-03-12 14:05:27 -04:00
|
|
|
seven.Connected = true;
|
|
|
|
seven.ConnectionDetails = obj;
|
2024-06-16 20:19:31 -04:00
|
|
|
Logger.Information("Connected to 7tv websockets.");
|
2024-03-12 14:05:27 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|