add signalr support

This commit is contained in:
2023-01-25 08:48:50 -05:00
parent 1ee15a8ed3
commit 5a015b379b
9 changed files with 89 additions and 61 deletions

22
NoteHub.cs Normal file
View File

@ -0,0 +1,22 @@
using BinaryDad.Notes.Services;
using Microsoft.AspNetCore.SignalR;
namespace BinaryDad.Notes
{
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);
}
}
}