Comments (4)
In every other programming environment I'm used to, a "session" attribute persists as long as the session exists, across multiple requests. You don't need to re-set it each time. So on creation of a new session, you may look up user details and persist them in the session, so every subsequent request will have access to it. That's the whole point of a session! Never have I see "session" attributes that automatically disappear after the next request.
That's why I copy them over, so you can set them once and they will get re-sent with each request. IMO, this is a very desirable feature. If you want to clear a session attribute, you can do response.session(key,null).
I guess I could make this optional, but I would still prefer to default it to enabled, because that's what makes sense to me. I'm open to hearing further arguments. :)
from alexa-app.
Oh I see, you thinking of them like cookies. "Here's an attribute, tell me what it is on every subsequent request." I can certainly see that as a way they could have been implemented. I doubt they'll change it to be that way because it would break ASKs already being approved. The ship has sailed! Plus it's trivial to persist any attributes that you want, and that puts more power control in the hands of the developer which is likely the desired outcome.
My main problem with what you're doing is this is a case where you are redefining the default behavior of how Alexa apps work, which I don't think is a module's business and actually makes it more difficult for a developer to switch to using your module. You're basically injecting your belief in how you think the Alexa SDK should have been made in to this implementation.
I think ideally someone should be able to simply move their logic from their own app to one managed by this module without having to change any of the fundamental logic. But with this default behavior, the user would need to rethink how they handled sessionAttributes to ensure that it still works.
Another reason it's undesirably is that someone reading the source code of an app built on alexa-app will likely not know about this redefined behavior and when trying to understand how the app works, will make (reasonable) false conclusions. If the app had a call in there saying "persist all session attributes" then it would be more semantically understandable.
from alexa-app.
I see your point, but I do disagree. Every web programmer I know will expect "session" attributes to actually persist for the whole session. That's how sessions work! So, yes, this module is a little opinionated in that way, but I think it will actually make life much easier for most developers. By default, it will behave in the way they naturally expect.
I've just added a new option for the next (2.1) release that I'm working on:
app.persistentSession=false;
This will turn off the default behavior.
from alexa-app.
Oh I hadn't seen this yet. Perfect!
from alexa-app.
Related Issues (20)
- Support for CanFulfillIntentRequest HOT 7
- Errors when using KeepAlive-style CloudWatch events HOT 5
- Patch for directive Dialog.Delegate HOT 2
- Cannot get directive display to work in Alexa skill. HOT 5
- Not able to use alexa-app HOT 2
- APL Support ? HOT 6
- VideoApp Directive HOT 1
- alexa-verifier-middleware HOT 1
- request.userId returning the wrong user HOT 3
- Multi turn dialog
- How we can get user permissions list?
- ssml lowercase
- Firebase Promise Failure HOT 2
- Support for In-Skill Purchases (ISP)? HOT 1
- INVALID_REQUEST_TYPE HOT 3
- Chained callbacks not working. HOT 2
- Issues testing locally the Skill: alexa-app + express + ngrok HOT 2
- Xxxxx
- REPLACE_ALL play behavior has no effect HOT 1
- Catch User Profile Data
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 alexa-app.