Cleaned code up. Added OBS & 7tv ws support. Added dependency injection. App loads from yml file.
This commit is contained in:
26
OBS/Socket/Handlers/IdentifiedHandler.cs
Normal file
26
OBS/Socket/Handlers/IdentifiedHandler.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
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;
|
||||
Logger.LogInformation("Connected to OBS via rpc version " + obj.negotiatedRpcVersion + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user