Added hermes websocket support. Added chat command support. Added selectable voice command via websocket. Added websocket heartbeat management.

This commit is contained in:
Tom
2024-03-15 12:27:35 +00:00
parent b5cc6b5706
commit d4004d6230
53 changed files with 1227 additions and 461 deletions

View File

@@ -1,7 +1,6 @@
using CommonSocketLibrary.Abstract;
using CommonSocketLibrary.Common;
using Microsoft.Extensions.Logging;
using TwitchChatTTS.Seven.Socket.Context;
using TwitchChatTTS.Seven.Socket.Data;
namespace TwitchChatTTS.Seven.Socket.Handlers
@@ -9,12 +8,12 @@ namespace TwitchChatTTS.Seven.Socket.Handlers
public class SevenHelloHandler : IWebSocketHandler
{
private ILogger Logger { get; }
private SevenHelloContext Context { get; }
private Configuration Configuration { get; }
public int OperationCode { get; set; } = 1;
public SevenHelloHandler(ILogger<SevenHelloHandler> logger, SevenHelloContext context) {
public SevenHelloHandler(ILogger<SevenHelloHandler> logger, Configuration configuration) {
Logger = logger;
Context = context;
Configuration = configuration;
}
public async Task Execute<Data>(SocketClient<WebSocketMessage> sender, Data message)
@@ -27,30 +26,7 @@ namespace TwitchChatTTS.Seven.Socket.Handlers
seven.Connected = true;
seven.ConnectionDetails = obj;
// if (Context.Subscriptions == null || !Context.Subscriptions.Any()) {
// Logger.LogWarning("No subscriptions have been set for the 7tv websocket client.");
// return;
// }
//await Task.Delay(TimeSpan.FromMilliseconds(1000));
//await sender.Send(33, new IdentifyMessage());
//await Task.Delay(TimeSpan.FromMilliseconds(5000));
//await sender.SendRaw("{\"op\":35,\"d\":{\"type\":\"emote_set.*\",\"condition\":{\"object_id\":\"64505914b9fc508169ffe7cc\"}}}");
//await sender.SendRaw(File.ReadAllText("test.txt"));
// foreach (var sub in Context.Subscriptions) {
// if (string.IsNullOrWhiteSpace(sub.Type)) {
// Logger.LogWarning("Non-existent or empty subscription type found on the 7tv websocket client.");
// continue;
// }
// Logger.LogDebug($"Subscription Type: {sub.Type} | Condition: {string.Join(", ", sub.Condition?.Select(e => e.Key + "=" + e.Value) ?? new string[0])}");
// await sender.Send(35, new SubscribeMessage() {
// Type = sub.Type,
// Condition = sub.Condition
// });
// }
Logger.LogInformation("Connected to 7tv websockets.");
}
}
}