whmcsk / ngx-signalr Goto Github PK
View Code? Open in Web Editor NEWAngular下一个适配signalr的库组件
License: MIT License
Angular下一个适配signalr的库组件
License: MIT License
OpaqueToken has been replaced by InjectionToken
Hi everyone. I'm having trouble talking to multiple hubs on different backends.
Let's assume the following
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.