2024-03-12 14:05:27 -04:00
|
|
|
using CommonSocketLibrary.Abstract;
|
|
|
|
using CommonSocketLibrary.Common;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
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-03-15 08:27:35 -04:00
|
|
|
public SevenHelloHandler(ILogger<SevenHelloHandler> 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;
|
|
|
|
|
|
|
|
seven.Connected = true;
|
|
|
|
seven.ConnectionDetails = obj;
|
2024-03-15 08:27:35 -04:00
|
|
|
Logger.LogInformation("Connected to 7tv websockets.");
|
2024-03-12 14:05:27 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|