Expand my Community achievements bar.

SOLVED

Server Integration and accountmanager life time

Avatar

Level 3

Hello AFCS team,

A while ago i was trying to cache the account manager but was getting some errors on .createRoom  or .getsession after a while, which told me that the accountmanager is valid for a certain amount of time only.

How long should i cache it ?

        am = afcs.accountmanager(AFCS_ACCOUNT_URL)

        am.login(AFCS_DEV_USER, AFCS_DEV_PASSWORD)

Thanks,

Greg

1 Accepted Solution

Avatar

Correct answer by
Employee

coulix,

two options (and then I'll promise I will add to my list of things to do a way to better manage this isse) :

1) cache the account object, but keep track of usage. After 20 minutes of inactivity delete the current object and create a new one

2) catch the error (that should say something like the request is not authenticated) and again delete the current object and create a new one

there may be a third option available, but I confess I never tried to see what really happen, but I am assuming that the authentication token we are using expires after some time passes with no requests going to the server. If this is true, the other option is to have a timer that kicks in every 20 minutes or so and does a REST request. This should be enough to keep the authentication token alive.

Please give it a try and let me know what the results are. Again, there is definitively something we can do to make your life a little easier, and I'll keep it in mind and sneak something in on one of the next iterations of the client SDK.

View solution in original post

1 Reply

Avatar

Correct answer by
Employee

coulix,

two options (and then I'll promise I will add to my list of things to do a way to better manage this isse) :

1) cache the account object, but keep track of usage. After 20 minutes of inactivity delete the current object and create a new one

2) catch the error (that should say something like the request is not authenticated) and again delete the current object and create a new one

there may be a third option available, but I confess I never tried to see what really happen, but I am assuming that the authentication token we are using expires after some time passes with no requests going to the server. If this is true, the other option is to have a timer that kicks in every 20 minutes or so and does a REST request. This should be enough to keep the authentication token alive.

Please give it a try and let me know what the results are. Again, there is definitively something we can do to make your life a little easier, and I'll keep it in mind and sneak something in on one of the next iterations of the client SDK.