How can I share the variable in the scope of each sessions?

Hi,

I’m trying to make a trial service using backendless.
I would like to use variables shared in the scope of each sessions.
I found only 2 ways for handling variables in codeless logic, Varible and Cache.
It looks for me that variables are in page scope, and caches are in global scope.
Are there any way to share variables in session scope?

Thanks in advance,
Manabu from NoCodeCamp in Japan.

Hi Manabu,

Any data you put into the App Data will be scoped to session.

Regards,
Mark

Hi Mark,

Oh I remember it.
I could select app variables in this screen.
But now I can’t see app select box in my blocks.
Could you help me?

BR,
Manabu

What is the “app select box” ?

Sorry, I was confused with thunkable.
What’s app data?
Are there any documents?

I’m using variable like ‘aa’ in the previous screen shot.
Can I access this variable from another logics?

Thanks in advance,
Manabu

Are you working on UI or Server-side logic? The screenshot you shared shows server-side logic, however, the original message made me think you’re working on the UI.

If you’re working on the business logic, there is no state - every invocation of the service is stateless.

It’s bad news for me.
I’m joining NoCodeCamp in Japan, then I have strong interest in codeless logic.
If there are no state for codeless logic, I can’t imagine it’s use cases.
Do you have any plan to enhance about state in the near future?

BR,
Manabu

All modern API services (especially the serverless ones) must be stateless. There is no guarantee that your service will be invoked on the same machine where the previous invocation stored state. You can use the Caching API to persist any information between the invocations, but storing it in memory is a very bad idea.

Oh I see.
Thanks for your explanation.

Manabu

You are very welcome. Btw, this is not related to Codeless. It is a general rule that applies to all API services regardless of how they are implemented. The entire Backendless platform is built that way - all APIs we offer out of the box are stateless.

Regards,
Mark

I know a little bit about the concept of REST, but I was preoccupied with NoCode.
Excuse me.

From Backendless REST design perspective, should I use the properties of user management for session management?

Thanks,
Manabu

Rather than focusing on a solution, how about we start with the problem definition? :slight_smile: What are you trying to accomplish?

Now we are developing a SNS application with Backendless and AppGyver for a trial in our community, NoCodeCamp in Japan.
We are planning to end this project within this year. Now we end week 1 as planning phase.
Now we are in week 2 for deciding architecture.
We will implement in week 3 and 4 and release in early next year.
Please notice that it’s just trial and very early release.
Then I don’t have much time.

I would like to follow the URL below at this time.

Any suggestions?

BR,
Manabu

Hi Manabu,

Thank you for the information, however, I am confused now. You started by asking about storing data in sessions and now we ended with the article you referenced.

You said you wanted to follow the article. Ok, that’s great. Did you run into a problem? If you did, what is it? Please be specific in describing the problem you’re experiencing.

Regards,
Mark

The problem is my misunderstand.
I tried to handle session state in business logic, but now I know it was wrong conceptually.
Then I searched the articles and it looks like good for me.
I’d like to try it this time because I don’t have much time.

Is this enough information for you ?
BR,
Manabu

Do you have an authenticated user in your app?

Yes I can have !

Great. In this case, I recommend using the Cache API (blocks) and for the key name connector use User Token:

This way Backendless Cache will contain data associated with the user’s session.