mirror of
https://github.com/yawaflua/WebSockets.git
synced 2025-12-08 19:39:30 +02:00
18 lines
552 B
C#
18 lines
552 B
C#
using System.Text.Json;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using yawaflua.WebSockets.Attributes;
|
|
using yawaflua.WebSockets.Core;
|
|
using yawaflua.WebSockets.Models.Abstracts;
|
|
|
|
namespace Examples;
|
|
|
|
[WebSocket("/test")]
|
|
public class TestWebSocketServer : WebSocketController
|
|
{
|
|
|
|
[WebSocket("/sub-test")]
|
|
public override async Task OnMessageAsync(WebSocket webSocket, HttpContext httpContext)
|
|
{
|
|
await webSocket.SendAsync("Test! Now on it endpoint: " + WebSocketManager.GetAllClients().Count(k => k.Path == webSocket.Client.Path));
|
|
}
|
|
} |