SignalR - Jquery response - 304 error
-
Dear all, I am running the following script on the client-side and the script is failing to update, when there is change in the database. I debugged the script using web-browser debugger and discovered my Jquery scripts are responding back as "304 not modified". I am assuming the server code is sending 304 resp. if so, what tests can I carry out, to help me debug server code, to find where the logic maybe going wrong. Client-side:
<script src="../Scripts/jquery-1.6.4.js"></script>
<script src="../Scripts/jquery.signalR-2.1.2.min.js"></script>
<script src='<%: ResolveClientUrl("~/signalr/hubs") %>'></script>
<script type="text/javascript">
$(function () {
// Declare a proxy to reference the hub.
var notifications = $.connection.NotificationHub;
// Create a function that the hub can call to broadcast messages.
notifications.client.recieveNotification = function (role, descrip) {
// Add the message to the page.
$('#spanNewMessages').text(role);
$('#spanNewCircles').text(descrip);
};
// Start the connection.
$.connection.hub.start().done(function () {
notifications.server.sendNotifications();
alert("Notifications have been sent.");}).fail(function (e) { alert(e); }); //$.connection.hub.start();
});
</script>New Notifications
New = role.
New = descrip.The server side code is created signalR hub class and also has sql dependency logic as well:
[HubName("NotificationHub")]
public class notificationHub : Hub
{
string role = "";
string descrip = "";\[HubMethodName("sendNotifications")\] public void SendNotifications() { using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings\["##########"\].ConnectionString)) { string query = "SELECT top 1 \[role\],\[description\] FROM \[dbo\].\[User\] order by uploadDate desc"; connection.Open(); SqlDependency.Start(GetConnectionString()); using (SqlCommand command = new SqlCommand(query, connection)) { try { command.Notification = null; DataTable dt = new DataTable(); SqlDepe