mirror of
https://github.com/yawaflua/WebSockets.git
synced 2025-12-08 19:39:30 +02:00
17 lines
475 B
C#
17 lines
475 B
C#
using yawaflua.WebSockets.Attributes;
|
|
using yawaflua.WebSockets.Models.Abstracts;
|
|
using WebSocket = yawaflua.WebSockets.Core.WebSocket;
|
|
|
|
namespace Examples;
|
|
|
|
[WebSocket("/chat")]
|
|
public class ChatController : WebSocketController
|
|
{
|
|
|
|
public override async Task OnMessageAsync(
|
|
WebSocket webSocket,
|
|
HttpContext httpContext)
|
|
{
|
|
await WebSocketManager.Broadcast(k => k.Path == "/chat", $"{webSocket.Client.Id}: {webSocket.Message}");
|
|
}
|
|
} |