You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
503 B
C#

12 months ago
using Microsoft.AspNet.SignalR;
namespace Ds.Module.SignalR
{
public class NotificationHub : Hub
{
public void SendNotification(string userId, string message)
{
// 发送通知给指定用户
Clients.User(userId).receiveNotification(message);
//用法
//var hubContext = GlobalHost.ConnectionManager.GetHubContext<NotificationHub>();
//hubContext.Clients.User(userId).receiveNotification(message);
}
}
}