Comments (2)
@pshahid I'm glad you find this project useful.
I can see how it would be useful to allow multiple connections, but I can't think of a way to do that without complicating the API.
You might be able to pull this off with a decorator. I'll play around with this a bit to see if I can come up with something.
from angular-wamp.
@pshahid You can try something like this:
//Create a new provider called $wamp2 that wraps $wamp
.provider('$wamp2', function ($wampProvider) {
var options;
this.init = function (initOptions) {
options = initOptions || {};
};
this.$get = function ($rootScope, $q, $log) {
var wp = $wampProvider;
wp.init(options);
return wp.$get($rootScope, $q, $log);
};
})
//Configure the $wamp2 service
.config(function ($wamp2Provider) {
$wamp2Provider.init({
url: 'ws://127.0.0.1:8080',
realm: 'realm1'
});
})
//Start $wamp2
.run(function ($wamp2) {
$wamp2.open();
});
Now you can inject $wamp2
into your controller and use it just like $wamp
.
With this setup, the events that get broadcasted will be sent to both services, which will cause some problems, especially during reconnections.
I'm going to see if I can get rid of the events, which will allow you to add as many connections as you'd like, without any issues.
from angular-wamp.
Related Issues (20)
- Publish latest 0.1.7 to npm HOT 2
- Any thoughts on Angular 2? HOT 13
- Set realm from variable HOT 2
- Session not open error on re connection
- subscribeOnScope promise does not return subscription HOT 2
- Error: [$rootScope:inprog] when subscribing to two Topics HOT 2
- Multiple connections, returned functions use options from last connection
- Unsubscribe gives error HOT 2
- Bower mismatch HOT 1
- connection alternatives HOT 3
- Version on npm is outdated HOT 1
- Working Example HOT 1
- is it possible to use angular-wamp with gos web socket bundle.? HOT 1
- Unable to subscribe from a topic. HOT 1
- Reconnect after connection lost HOT 5
- error callback on subscribe failure is not getting called. HOT 6
- Update dependencies HOT 1
- Cannot uglify on Gulp HOT 1
- problem angular-wamp in angular4 HOT 2
- Establishing a tunnel via proxy server failed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-wamp.