Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6956147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:49:49+00:00 2026-05-27T14:49:49+00:00

I’m relatively new to all the intricacies of javascript so perhaps this timing issue

  • 0

I’m relatively new to all the intricacies of javascript so perhaps this timing issue is just my lack of understanding how to program valid javascript for event handling.

I have two SignalR hubs being used on a single page. One is a chat hub and that works 100% of the time. The other is used with with some Raphael js objects and it is the one I’m having issues with.

I have a click event on one of the raphael circle objects and when I click on it shortly after the screen is loaded my C# hub method is not called. When this happens the error in Chrome’s dev tool’s console is “SignalR: Connection must be started before data can be sent. Call .start() before .sent()” The javascript event that calls the hub cs method is always called. The strange thing is that when I wait a few seconds the cs hub method always seems to work as expected. It’s like it takes a couple seconds to load the hub events. Has anyone else ever ran into this type of scenario?

I do have my js code in $(document).ready(function() {… but I’m guessing that because the Raphael js objects are not part of the dom until the js code is ran, it would not force them to load.

$(document).ready(function() {
    var clientHub = $.connection.tableHub;

    var canvas = Raphael((innerWidth / 2) + 83, (innerHeight / 2) - 194, 74, 74);
    var circle1 = seat1Canvas.circle(37, 37, 35);
    var circle1Text = seat1Canvas.text(37, 37, "Open");

    var buildCircleAndSendToClients = function() {
        clientHub.buildCircle(identity.Name);
    };

    var drawAvailableCircle = function() {
        circle1 = seat1Canvas.circle(37, 37, 35);
        circle1Text = seat1Canvas.text(37, 37, "Sit\nHere");
        circle1.attr("fill", "#fffeee");
        circle1.attr("stroke", "black");
        circle1.attr("stroke-width", 3);
        circle1.mousedown(buildCircleAndSendToClients);
    };

    circle1.attr("fill", "#eeefff");
    circle1.attr("stroke", "black");
    circle1.attr("stroke-width", 3);
    circle1.mouseover(drawAvailableCircle);

    clientHub.drawCircle = function(username) {
        circle1 = seat1Canvas.circle(37, 37, 35);
        circle1Text = seat1Canvas.text(37, 37, username);
        circle1.attr("fill", "#eeefff");
        circle1.attr("stroke", "black");
        circle1.attr("stroke-width", 3);
    };

    $.connection.hub.start();
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:49:50+00:00Added an answer on May 27, 2026 at 2:49 pm

    You need to move your wireup for handlers that will interact with the SignalR connection into a callback function that you pass as a parameter to the start method. This will ensure the handlers aren’t active until the hub connection has started. You might want to alter the UI slightly too until that callback runs, eg have the buttons be disabled by default and only enable them once the handlers are wired up.

    E.g:

    $.connection.hub.start(function() {
    // wireup handlers and enable UI here
    });

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am relatively new to Javascript so I'm hoping this is a simple mistake.
I'm relatively new with css, but was having an issue trying to accommodate all
First of all, let me say that I'm relatively new to SOAP/WSDL/API, so this
I am relatively new to web development and learning all the time. I have
Being relatively new to functional programming, I expend lots of energy wondering is this
I'm relatively new to web application programming so I hope this question isn't too
Introduction I'm relatively new to C++. I went through all the basic stuff and
I am a relatively new programmer so this may be a really simple question
I am relatively new to .Net and C# development and am having an issue
I am relatively new to MYSQL and have had an issue that has been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.