Skip to content

Instantly share code, notes, and snippets.

@reflash
Created July 29, 2024 20:16
Show Gist options
  • Save reflash/fcd0f2eae424519fd7aebee312063959 to your computer and use it in GitHub Desktop.
Save reflash/fcd0f2eae424519fd7aebee312063959 to your computer and use it in GitHub Desktop.
public class MessageHub: Hub
{
public async Task JoinGroup(string groupId)
{
await Groups.AddToGroupAsync(Context.ConnectionId, groupId);
}
public async Task BroadcastMessage(string groupId, string method, string message)
{
await Clients.Group(groupId).SendAsync(method, message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment