0

I have multiple Web apps using SignalR, generating different local hubs.

I was wondering, would it be possible to give the server URL to the application A so it generates the local SignalR hubs directly on the centralised server, so then the application B could reference the generated hubs directly from the server, instead of creating a proxy on the application B to listen to the the application A broadcast?

public class ApplicationA : Hub //https://applicationAurl
{
    public void SendFromApplicationA(string name, string message)
    {
        Clients.All.addMessage(name, message);
    }
}


public class ApplicationB : Hub //https://applicationBurl
{
    public void SendFromApplicationB(string name, string message)
    {
        Clients.All.addMessage(name, message);
    }
}

So if these hubs were created on the server instead of the mother app, the application C should be able to listen to both on the client side, like something below.

$.connection.hub.url = "http://centralisedserver/signarl";
$.connection.hub.start();

var SendFromApplicationAHub= $.connection.applicationA;
SendFromApplicationAHub.client.SendFromApplicationA = function () {//do something}

var SendFromApplicationBHub= $.connection.applicationB;
SendFromApplicationBHub.client.SendFromApplicationB = function () {//do something}
threesixnine
  • 1,733
  • 7
  • 30
  • 56
  • Perhaps this: https://stackoverflow.com/questions/16170373/signalr-broadcasting-over-a-hub-in-another-project-from-outside-of-a-hub – danish Apr 20 '18 at 09:55
  • @danish Not really the same thing I'm trying to do, that is sort of a proxy generation question. I'm trying to merge all hubs from different apps and have a single end point for all of them. – threesixnine Apr 20 '18 at 10:26
  • Ah ok, I have not done anything like that so can't really help. Probably will attempt to do. I did found this one the web. Don't know if this is what you need. https://www.codeproject.com/Articles/898992/RESTful-SignalR-Service – danish Apr 20 '18 at 12:28

0 Answers0