Create project files

This commit is contained in:
Dmitri Shimanski
2025-03-29 02:34:08 +03:00
commit abab2be4f4
32 changed files with 1057 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
using System.Net.WebSockets;
using Microsoft.AspNetCore.Http;
using yawaflua.WebSockets.Models.Interfaces;
namespace yawaflua.WebSockets.Models;
internal class WebSocketClient : IWebSocketClient
{
private HttpContext HttpContext { get; set; }
public Guid Id { get; } = Guid.NewGuid();
public string Path { get; }
public ConnectionInfo ConnectionInfo { get => HttpContext.Connection; }
public IDictionary<object, object> Items
{
get => HttpContext.Items;
set => HttpContext.Items = (value);
}
public HttpRequest HttpRequest { get => HttpContext.Request; }
public WebSocket webSocket { get; }
internal WebSocketClient(HttpContext httpContext, WebSocket webSocket, string path)
{
this.webSocket = webSocket;
Path = path;
this.HttpContext = httpContext;
}
public Task Abort()
{
webSocket.Abort();
return Task.CompletedTask;
}
}