Open nibavsyed opened 8 years ago
@@section Scripts{@
<!--Reference the autogenerated SignalR hub script. --> <script src="/signalr/hubs" type="text/javascript"></script> <script> $(document).ready(function () { $("#userTable").DataTable(); }); </script>
<script type="text/javascript"> $(function () { //alert('First inside the hub script'); //$("#userTable").DataTable(); // Declare a proxy to reference the hub. var notifications = $.connection.messagesHub; alert('Second inside the hub script'); //$.connection.hub.url = "http://localhost:53612/signalr/hubs"; //registerClientMethods(notifications); //debugger; // Create a function that the hub can call to broadcast messages. notifications.client.updateMessages = function () { getAllMessages() }; // Start the connection. $.connection.hub.start().done(function () { alert("connection started"); getAllMessages(); }).fail(function (e) { alert(e); }); //// Start Hub //$.connection.hub.start({ waitForPageLoad: false }).done(function () { // alert("connection started") // //registerEvents(notifications) // getAllMessages(); //}); }); function getAllMessages() { alert('inside the getAllMessages Function'); var tbl = $('#userdivTable'); $.ajax({ url: '/MessagesSend/GetMessages', contentType: 'application/html ; charset:utf-8', type: 'GET', dataType: 'html' }).success(function (result) { tbl.empty().append(result); }).error(function () { }); } </script>
@}@
I am using Visual studio 2013 MVC5
var notifications = $.connection.messagesHub; the above statement is not executed
me too ,the dependency_OnChange not work !
https://www.codeproject.com/Articles/883702/Real-Time-Notifications-using-SignalR-and-SQL-Depe
@@section Scripts{@
@}@