Notes/NoteHub.cs
2023-10-30 10:07:35 -04:00

25 lines
547 B
C#

using BinaryDad.Notes.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.SignalR;
namespace BinaryDad.Notes
{
[Authorize]
public class NoteHub : Hub
{
private readonly INoteService noteService;
public NoteHub(INoteService noteService)
{
this.noteService = noteService;
}
public async Task SaveNote(string content)
{
noteService.Save(content);
await Clients.Others.SendAsync("updateNote", content);
}
}
}