mirror of
https://github.com/yawaflua/WebSockets.git
synced 2025-12-09 20:09:32 +02:00
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.
25 lines
859 B
C#
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;
|
|
}
|
|
} |