mirror of
https://github.com/yawaflua/WebSockets.git
synced 2026-02-04 14:04:11 +02:00
Create project files
This commit is contained in:
34
yawaflua.WebSockets/Models/WebSocketClient.cs
Normal file
34
yawaflua.WebSockets/Models/WebSocketClient.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user