Giter Site home page Giter Site logo

ngx-signalr's People

Contributors

alan-agius4 avatar ascode avatar davemonag avatar hneukermans avatar italojs avatar saaka avatar shaulbehr avatar yurlovm avatar

Watchers

 avatar

ngx-signalr's Issues

Multiple Hub at multiple locations

Hi everyone. I'm having trouble talking to multiple hubs on different backends.

Let's assume the following

  • NG-Project as UI running on localhost
  • DataService with a DataHub running on localhost:81
  • EvaluationService with EvaluationHub running on localhost:82

In my NG project, I defined two services

@Injectable()
@Hub({ hubName: 'DataHub' })
export class DataHubService {
  constructor (private hubService: HubService) {
    this.hubWrapper = this.hubService.register(this);
    this.hubService.connect('http://localhost:81/signalr').toPromise();
  }
}

@Injectable()
@Hub({ hubName: 'EvaluationHub' })
export class EvaluationHubService {
  constructor (private hubService: HubService) {
    this.hubWrapper = this.hubService.register(this);
    this.hubService.connect('http://localhost:82/signalr').toPromise();
  }
}

Calling the connect method on hubService now tries to establish a connection with the given backend url but expects all hubs to be on this url. As the code states all Hub-decorators are called and their named are beeing collected in a global variable.

//all the hubs/events we have to subscribe to when setting up the connection.
//signalr requires you to connect to all the hubs before making the connection
//so we store them in a global var.
var allHubProperties = [];

Is there any way to accomplish the above-mentioned case? If not so, I would like to propose the introduction of a HubGroup that goes into the Hub-decorator and also into the connect method to specify which hubs are on which server. What do you think?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.