我有一个SignalR集线器,我从JQuery成功调用。从.net代码和JavaScript调用SignalR集线器
public class UpdateNotification : Hub
{
public void SendUpdate(DateTime timeStamp, string user, string entity, string message)
{
Clients.All.UpdateClients(timeStamp.ToString("yyyy-MM-dd HH:mm:ss"), user, entity, message);
}
}
更新消息从JS成功发送,像这样
var updateNotification = $.connection.updateNotification;
$.connection.hub.start({ transport: ['webSockets', 'serverSentEvents', 'longPolling'] }).done(function() { });
updateNotification.server.sendUpdate(timeStamp, user, entity, message);
,并成功接收,像这样
updateNotification.client.UpdateClients = function (timeStamp, user, entity, message) {
我不能工作如何从我的控制器中调用sendUpdate。