mirror of
https://github.com/yawaflua/WebSockets.git
synced 2025-12-09 20:09:32 +02:00
adds comments, OOP incapsulation and publish package to nuget
This commit is contained in:
@@ -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}");
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user