Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. SignalR - Jquery response - 304 error

SignalR - Jquery response - 304 error

Scheduled Pinned Locked Moved ASP.NET
javascriptdatabasedebugginghelpsysadmin
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    miss786
    wrote on last edited by
    #1

    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
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups