mirror of
https://github.com/ryzij/AMessanger-Server.git
synced 2026-09-18 19:25:38 +00:00
Переместил ChatHub в слой Application
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../AMessanger.Core/AMessanger.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,14 @@
|
||||
using AMessanger.Core.Models;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace AMessanger.Application.Hubs;
|
||||
|
||||
public class ChatHub(ILogger<ChatHub> logger) : Hub
|
||||
{
|
||||
public async Task SendMessage(Message message)
|
||||
{
|
||||
logger.LogInformation($"{message.UserName}: {message.Content}");
|
||||
await Clients.All.SendAsync("ReceiveMessage", message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user