Comments (6)
@taion I'm using $q.when
to wrap the autobahn promise with a $q promise, so that the returned value is a $q promise instead of an autobahn one, which makes it resolve within the digest cycle.
I'm not sure if $q.defer
would behave the same way.
Is there a particular issue that this is causing?
from angular-wamp.
Nope, this is just idle speculation - it just looks like the use_deferred
connection option would let you skip the wrapping step and just have AutobahnJS directly use the $q.defer
constructor instead of having to wrap it. Might be a minor optimization.
from angular-wamp.
@taion Sorry, I didn't understand your original question. I've made this change.
Can you test it out and let me know if it's working as expected?
from angular-wamp.
This change works for me. It's not a big thing, but I think it's a little bit cleaner. You may want to undocument the deferral-related options, since they're no longer relevant, though:
angular-wamp/src/angular-wamp.js
Line 57 in 43d0721
from angular-wamp.
All options can be overwritten in the config. I'm not sure if there really is a use case for changing the deferred or not, but I'll leave it there for consistencies sake and just add a note.
from angular-wamp.
The only case I can really think of where you'd want something beyond the $q.defer might be for angular-poller, because it's a bit annoying that those promises can't ever get resolved, so they can't go into a route's resolve block. That's quite a stretch, though, and presumably you wouldn't be using angular-poller if you're using something WAMP-based anyway.
Thanks!
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.