Files
WebSockets/yawaflua.WebSockets/Models/Abstracts/WebSocketController.cs
Dmitri Shimanski c851815a2c Refactor WebSocket routing and error handling logic
Replaces `Dictionary` with `ConcurrentDictionary` for thread-safe WebSocket route management and improves error logging with added debug assertions. Also fixes duplicate registrations, enhances dependency injection, updates package references, and adjusts WebSocket attribute structure for better extensibility and usage.
2025-05-25 03:32:33 +03:00

25 lines
859 B
C#

using Microsoft.AspNetCore.Http;
using yawaflua.WebSockets.Core;
using yawaflua.WebSockets.Models.Interfaces;
using WebSocketManager = yawaflua.WebSockets.Core.WebSocketManager;
namespace yawaflua.WebSockets.Models.Abstracts;
public abstract class WebSocketController : IWebSocketController
{
/// <summary>
/// WebsocketManager provides work with all clients
/// </summary>
public IWebSocketManager WebSocketManager => new WebSocketManager();
/// <summary>
/// Example of function OnMessage
/// </summary>
/// <param name="webSocket">WebSocket with provided data about user e.t.c.</param>
/// <param name="httpContext">Http context of request</param>
/// <returns></returns>
public virtual Task OnMessageAsync(IWebSocket webSocket, HttpContext httpContext)
{
return Task.CompletedTask;
}
}