adds comments, OOP incapsulation and publish package to nuget

This commit is contained in:
Dmitri Shimanski
2025-03-29 02:54:54 +03:00
parent 2ba9667a01
commit 1b1eb17bee
11 changed files with 103 additions and 19 deletions

View File

@@ -1,6 +1,6 @@
using yawaflua.WebSockets.Attributes;
using yawaflua.WebSockets.Models.Abstracts;
using WebSocket = yawaflua.WebSockets.Core.WebSocket;
using yawaflua.WebSockets.Models.Interfaces;
namespace Examples;
@@ -9,7 +9,7 @@ public class ChatController : WebSocketController
{
public override async Task OnMessageAsync(
WebSocket webSocket,
IWebSocket webSocket,
HttpContext httpContext)
{
await WebSocketManager.Broadcast(k => k.Path == "/chat", $"{webSocket.Client.Id}: {webSocket.Message}");

View File

@@ -1,8 +1,6 @@
using System.Text.Json;
using Microsoft.AspNetCore.Mvc;
using yawaflua.WebSockets.Attributes;
using yawaflua.WebSockets.Core;
using yawaflua.WebSockets.Attributes;
using yawaflua.WebSockets.Models.Abstracts;
using yawaflua.WebSockets.Models.Interfaces;
namespace Examples;
@@ -11,7 +9,7 @@ public class TestWebSocketServer : WebSocketController
{
[WebSocket("/sub-test")]
public override async Task OnMessageAsync(WebSocket webSocket, HttpContext httpContext)
public override async Task OnMessageAsync(IWebSocket webSocket, HttpContext httpContext)
{
await webSocket.SendAsync("Test! Now on it endpoint: " + WebSocketManager.GetAllClients().Count(k => k.Path == webSocket.Client.Path));
}