mirror of
https://github.com/chsakell/aspnet-core-signalr-angular.git
synced 2025-12-22 17:27:48 +00:00
integrate Web API and SignalR
This commit is contained in:
17
Hubs/Broadcaster.cs
Normal file
17
Hubs/Broadcaster.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace LiveGameFeed.Hubs
|
||||
{
|
||||
public class Broadcaster : Hub
|
||||
{
|
||||
public override Task OnConnected()
|
||||
{
|
||||
return Clients.All.Message("New connection " + Context.ConnectionId);
|
||||
}
|
||||
public Task Broadcast(string message)
|
||||
{
|
||||
return Clients.All.Message(Context.ConnectionId + "> " + message);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user