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

  • Home
  • SEARCH
  • 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 9039385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:43:03+00:00 2026-06-16T09:43:03+00:00

I have simple project in ASP.NET Web site with signalr. Code for start connection

  • 0

I have simple project in ASP.NET Web site with signalr.
Code for start connection hub:

var scriptStarted = 'var myHub = $.connection.' + hubName + ';' + methodNameInitHub + '(myHub);';
$.connection.hub.error(function () {
    alert("An error occured");
});

$.connection.hub.start()
                        .done(function () {
                            eval(scriptStarted);
                            myHub.server.registerClient($.connection.hub.id, clientIdentifier);
                        })
                        .fail(function () { alert("Could not Connect!"); });

This method is call in “methodNameInitHub + ‘(myHub);”

function methodInitEventHub(hub) {
            if (hub) {
                hub.client.addEvent = function (eventOperationName, eventType) {
                    $("#events").append("<li>" + eventOperationName + ", " + eventType + "</li>");
                };
            }
        }

Code for stop connection hub:

$.connection.hub.stop();

When I load .aspx page and start hub all code execute without errors, but event from server not recieved.
After I stop and start again hub connection events begining received in client (browser)
http://clip2net.com/s/2CP2e

Why I need to restart connection hub for begin received event from server ?
Thanks.

  • 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-06-16T09:43:05+00:00Added an answer on June 16, 2026 at 9:43 am

    The reason you’re having issues is because you must have at least 1 client side hub function prior to calling start otherwise you will not be subscribed to the hub.

    Try doing

    myHub.client.foo = function() {}
    

    prior to start.

    The reason why it works after you stop then re-start the connection is because your script binds a new client method, hence allowing you to subscribe to the hub after you’ve restarted the connection.

    Hope this helps!

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

Sidebar

Related Questions

We have a web site built as an 'ASP.NET Website' type project, rather than
I have an ASP.NET 3.5 web site project. In it there exists a page
I have a simple asp.net MVC4 / EF 4.1 project created with VS 2011,
I have a Web App(.NET 4.0 ASP.NET MVC3) which uses SignalR(1.0.0 alpha 2) with
How can I run FxCop against an ASP.net Web-site? Background I have an ASP.net
When I worked on asp.net mvc web site project, I investigated different approaches for
I have an ASP.NET site that I am maintaining. Currently it has code that
I have created a new MVC2 project using the ASP.NET MVC2 Web Application, which
I have a web project using asp.net mvc3. Now clients ask for a security
I have an ASP.NET web project where I need to host a number of

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.