Comments (4)
Hi @bananabr , I'm not sure I'm seeing how that would work. If the function is asynchronous, does it go ahead and try to establish a connection before the promise has resolved?
from angular2-actioncable.
No, it should not.
I need to present a JWT for my connection to be established. To get the token I need I use a service that requests the token asynchronously from my OpenID provider.
No problem getting the fist token, I can wait for it and then pass it as a connection header or query param, but it needs to be refreshed once in a while and I could figure out how to make this work with the current version of angular2-actioncable.
from angular2-actioncable.
That seems like a similar problem to the one that prompted me to add the ability to use a callback to get the params. I use the angular token auth package which by default generates a new auth token for every request. So my cable connection call looks like this:
this.cableService.cable('example.com/cable', () => this.tokenService.currentAuthData)
In the case of a disconnect, the function will be re-evaluated to get the fresh authentication params.
from angular2-actioncable.
That seems like a similar problem to the one that prompted me to add the ability to use a callback to get the params. I use the angular token auth package which by default generates a new auth token for every request. So my cable connection call looks like this:
this.cableService.cable('example.com/cable', () => this.tokenService.currentAuthData)
In the case of a disconnect, the function will be re-evaluated to get the fresh authentication params.
Is this really possible? I just tried it but the same token (frist one) is being sent.
from angular2-actioncable.
Related Issues (12)
- way to confirm channel subscription HOT 3
- No way to send / broadcast to a particular event HOT 3
- this.baseCable.close is not a function HOT 2
- /node_modules/rxjs/Observable has no exported member 'Observable' HOT 1
- perform doesn't sent data properly? HOT 5
- Error when subscription is rejected HOT 2
- Passing authentication header HOT 2
- How can use ActionCable broadcast_to with specific group of users ? HOT 1
- Update to Angular 10
- sink._addParentTeardownLogic is not a function when using pipe() HOT 1
- Reconnect to channel 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 angular2-actioncable.