Skip to content

Commit 28e7b3c

Browse files
committed
Update ChatHub.cs
1 parent 2a7e8ca commit 28e7b3c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1+
using Jordnaer.Shared;
2+
using Microsoft.AspNetCore.Authorization;
13
using Microsoft.AspNetCore.SignalR;
24

35
namespace Jordnaer.Server.Features.Chat;
46

7+
[Authorize]
58
public class ChatHub : Hub
69
{
710
public async Task SendMessage(string user, string message)
811
{
912
//TODO: Add azure signalR
1013
await Clients.All.SendAsync("ReceiveMessage", user, message);
1114
}
15+
16+
public override Task OnConnectedAsync()
17+
{
18+
Context.User.GetId();
19+
return base.OnConnectedAsync();
20+
}
1221
}

0 commit comments

Comments
 (0)