Core logic ported from TS: HttpClientFactory, Environment and WebSocketHandler.

This commit is contained in:
2026-04-09 09:41:16 +02:00
parent 63e52336e2
commit 3ee4edac6c
6 changed files with 132 additions and 7 deletions

View File

@@ -1,6 +1,9 @@
using Chtn.CSharpSDK.Interfaces;
using System.Net.Http;
using System;
using System;
using System.Globalization;
using System.Net.WebSockets;
using System.Threading.Tasks;
using Chtn.CSharpSDK.Interfaces;
namespace Chtn.CSharpSDK.Core
{
@@ -8,15 +11,17 @@ namespace Chtn.CSharpSDK.Core
{
private readonly IKeyringAPI _keyring;
private readonly IDatabaseAPI _database;
private readonly HttpClient _httpClient;
private readonly WebSocketHandler _wsHandler;
public ChateniumClient(IKeyringAPI keyring, IDatabaseAPI database)
{
_keyring = keyring ?? throw new ArgumentNullException(nameof(keyring));
_database = database ?? throw new ArgumentNullException(nameof(database));
_httpClient = new HttpClient();
_httpClient.BaseAddress = new Uri("https://api.chatenium.hu");
_wsHandler = WebSocketHandler.GetInstance();
}
public async Task ConnectAsync(string userId, string token)
{
await _wsHandler.ConnectAsync(userId, token);
}
public void initialize()
{