main #37

Merged
seonkyu.kim merged 36 commits from seonkyu.kim/AcaMate_API:main into debug 2025-05-19 06:47:45 +00:00
2 changed files with 44 additions and 34 deletions
Showing only changes of commit 2b37dc2746 - Show all commits

View File

@ -1,15 +1,14 @@
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
namespace Back.Program.Common.Chat namespace Back.Program.Common.Chat;
public class ChatHub : Hub
{ {
public class ChatHub : Hub
{
// 클라이언트에서 메시지를 보내면 모든 사용자에게 전송 // 클라이언트에서 메시지를 보내면 모든 사용자에게 전송
public async Task SendMessage(string user, string message) public async Task SendMessage(string user, string message)
{ {
Console.WriteLine($"Message received: {user}: {message}"); Console.WriteLine($"Message received: {user}: {message}");
await Clients.All.SendAsync("ReceiveMessage", user, message); await Clients.All.SendAsync("ReceiveMessage", user, message);
} }
// 특정 사용자에게 메시지를 보냄 // 특정 사용자에게 메시지를 보냄
@ -33,10 +32,15 @@ namespace Back.Program.Common.Chat
Console.WriteLine("OnDisconnectedAsync"); Console.WriteLine("OnDisconnectedAsync");
await base.OnDisconnectedAsync(exception); await base.OnDisconnectedAsync(exception);
} }
public async Task JoinRoom(string cid)
{
await Groups.AddToGroupAsync(Context.ConnectionId, cid);
}
public async Task JoinGroup(string cid, string groupName)
{
await Groups.AddToGroupAsync(Context.ConnectionId, groupName);
} }
} }
/*
*/

View File

@ -0,0 +1,6 @@
namespace Back.Program.Controllers.V1;
public class ChatController
{
}