2023-01-25 13:48:50 +00:00
|
|
|
|
using BinaryDad.Notes.Services;
|
2023-10-30 14:07:35 +00:00
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
2023-01-25 13:48:50 +00:00
|
|
|
|
using Microsoft.AspNetCore.SignalR;
|
|
|
|
|
|
|
|
|
|
namespace BinaryDad.Notes
|
|
|
|
|
{
|
2023-10-30 14:07:35 +00:00
|
|
|
|
[Authorize]
|
2023-01-25 13:48:50 +00:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|