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 7958039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:21:30+00:00 2026-06-04T04:21:30+00:00

Basically I have 3 apps. A web app, Nservicebus, and a signalr self hosting

  • 0

Basically I have 3 apps. A web app, Nservicebus, and a signalr self hosting server for my hubs. I am currently using signalr version .4. Basically the web app initiates a connection with the self hosted server on page load. The User does an action which sends a command down the service bus. The service bus then connects to the signalr server to notify all the web clients.

My Web page:

<script src="http://localhost:8081/test/signalr/hubs" type="text/javascript"></script>
<script>
    jQuery.support.cors = true;
    var myHub;  

    $.connection.hub.url = 'http://localhost:8081/test/signalr/hubs';

    $(function () {
        myHub = $.connection.userAccountHub;

        myHub.ChangeNameUpdated = function (connId) {
            alert("recieved signalr message");          
        };

        $.connection.hub.start().done(function() {
            var myClientId = $.connection.hub.id;
            setCookie("srconnectionid", myClientId);
        });
    });

</script>

My SignalR server:

      static void Main(string[] args)
    {
        Debug.Listeners.Add(new ConsoleTraceListener());
        Debug.AutoFlush = true;

        string url = "http://localhost:8081/test/";
        var server = new Server(url);


        server.EnableHubs();
        server.Start();


        Console.WriteLine("Server running on {0}", url);

        while (true)
        strong text{
            ConsoleKeyInfo ki = Console.ReadKey(true);
            if (ki.Key == ConsoleKey.X)
            {
                break;
            }
        }
    }

My Hub inside my Signalr server project

 public class UserAccountHub : Hub
    {

        public void UsersNameChanged(string passedThroughConnectionId)
        {
            Clients.ChangeNameUpdated(passedThroughConnectionId);
        }
    }

My Call from my nservicebus

        //connect to signalRServer
        var connection = new HubConnection("http://localhost:8081/test/signalr/hubs");
        IHubProxy myHub = connection.CreateProxy("SignalRServer.Hubs.UserAccountHub");

        //Credentials are inherited from the application
        connection.Credentials = CredentialCache.DefaultNetworkCredentials;

        var test = message.GetHeader("signalrConnectionId");


        connection.Start().Wait();
        myHub.Invoke("UsersNameChanged", message.GetHeader("signalrConnectionId")).ContinueWith(task =>
        {
            //for debuging purposes
            if (task.IsFaulted)
            {
                Console.WriteLine(
                    "An error occurred during the method call {0}",
                    task.Exception.GetBaseException());
            }
            else
            {
                Console.WriteLine("Successfully called MethodOnServer");
            }
        });

I open up 2 browsers. I initiate the process on the second browser, and only the first one receives notifications. The second browser doesnt.

I don’t see any issues that stand out when I run fiddler either.

Is there a better approach to this implementation, or am I missing something?

  • 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-04T04:21:31+00:00Added an answer on June 4, 2026 at 4:21 am

    OK! David’s comments got me going in the right direction. Also noticed this was updated, didnt notice this before. Scroll to the bottom for the cross domain support

    1.) Updated to version .5

    2.) Modified my connection information in javascript to

    $.connection.hub.url = 'http://localhost:8081/test/signalr';
    
    $.connection.hub.start({ transport: 'longPolling', xdomain: true }).done(function () {
        //alert("staring hub connection:  " + $.connection.hub.id);
        setCookie("srconnectionid", $.connection.hub.id);
    });
    

    3.) I had to change the HubConnection

    var connection = new HubConnection("http://localhost:8081/test/");
    

    4.) I had to change the IHubProxy

    IHubProxy myHub = connection.CreateProxy("UserAccountHub");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have two separate web-apps, say 'retailUI' and 'bulkUI'. These two are basically two
I basically have a server set up and I'm accepting new clients(UNIX) and i'm
I have been using the Windsor IoC Container for my web-based application, to resolve
I have some Ruby web apps that use OpenID for authentication and store the
I have a web server that responds to a number of different sites on
I have a basic web app in place: it has a registration page, a
I'm about to develop this small website, its basically a simple web app to
I have a Preference class (module) that's used across several different apps. Basically it's
I have a bit of linq to entities code in a web app. It
I basically have three tables, posts, images and postimages (this simply contains the ids

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.