0
$scope.notification = $.connection.notificationsHub;
$scope.SendNotification = function (schoolId) {
$http({
url: "/Notifications/InsertNotification?SchoolId=" + schoolId+"&Notification="+$scope.Notification,
method: "GET"
}).then(function (res) {
console.log(res);
notification.client.sendNotification = function() {
getAllNotifications();
}
$.connection.hub.start().done(function() {
getAllNotifications();
}).fail(function (e) {
console.log(e);
alert(e);
})
function getAllNotifications() {
$http({
url: "/Notifications/Notifications?SchoolId=" + schoolId,
method: "GET"
}).then(function (res) {
console.log(res);
});
}
});
}
C#代碼(集線器類)
public void Send()
{
IHubContext context = GlobalHost.ConnectionManager.GetHubContext<NotificationsHub>();
context.Clients.All.SendNotification();
}
我試圖在owin啓動類添加地圖和所有的腳本被放置在正確的地方,我嘗試了這麼多的解決方案,它不起作用,我需要幫助:D