Signal R Notification
I am creating an application using signal r to send notification. I am using VS 2012. In my Notification view I have added the code below in @model App.Models.Notification. @{
Solution 1:
You also need to create a owin startup class. I will put code here for that (view same as your) :-
<scriptsrc="~/Scripts/jquery-1.10.2.min.js"></script><scriptsrc="~/Scripts/jquery.signalR-2.1.2.min.js"></script><scriptsrc="/signalr/hubs"></script><scripttype="text/javascript">
$(function () {
var proxy = $.connection.notificationHub;
alert(proxy);
$("#button1").click(function () {
alert($("#text1").val());
proxy.server.sendNotifications($("#text1").val());
alert(12);
});
$.connection.hub.start();
alert(14);
});
</script>
Notification Hub like :
publicclassNotificationHub : Hub
{
publicvoidHello()
{
Clients.All.hello();
}
publicvoidSendNotifications(string message)
{
Clients.All.receiveNotification(message);
}
}
Now Most importnant you need to create a owin startup class to start signal r, code like :
publicvoidConfiguration(IAppBuilder app){
app.MapSignalR();
}
Post a Comment for "Signal R Notification"