Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
namespace NotificationApp.Hubs
{
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR;
/// <summary>
/// Hub de notificaciones de la aplicación.
/// </summary>
public class NotificationHub : Hub
{
private UserService userService;
/// <summary>
/// Acción de notificación de una tarea completa.
/// </summary>
/// <param name="taskId">Identificador de la tarea.</param>
/// <param name="taskResult">Resultado de la tarea.</param>
public void Notificate(int taskId, bool taskResult)
{
Clients.All.markDone(taskId, taskResult);
}
/// <summary>
/// Método propio cuando se inicializa la conexión del hub.
/// </summary>
/// <returns>Task.</returns>
public override Task OnConnected()
{
userService.NewConnection(Context.ConnectionId);
return base.OnConnected();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.