var _apiUrl = null; function initIndex(url, apiUrl) { _apiUrl = apiUrl; //Set the hubs URL for the connection $.connection.hub.url = url; $.connection.hub.logging = true; // Declare a proxy to reference the hub. // var chat = $.connection.myHub; var chat = $.connection.weightedShortestJobFirstHub; // Create a function that the hub can call to broadcast messages. chat.client.addNotification = function (name, message) { // Html encode display name and message. console.log(message); var encodedName = $('
').text(name).html(); var encodedMsg = $('
').text("hash").html(); // Add the message to the page. $('#discussion').append('
  • ' + encodedName + ':  ' + encodedMsg + '
  • '); }; // Get the user name and store it to prepend to messages. $('#displayname').val(prompt('Enter your name:', '')); // Set initial focus to message input box. $('#message').focus(); // Start the connection. $.connection.hub.start({ transport: 'longPolling' }).done(function () { $('#sendmessage').click(function () { // Call the Send method on the hub. // chat.server.send($('#displayname').val(), $('#message').val()); var notification = { "id": 110743, "page": "effort", "username": "user", "time": 1737573418926, "value": 1 }; chat.server.notifyAll(notification); // Clear text box and reset focus for next comment. $('#message').val('').focus(); }); }); }