How to update/extend SGW session?


#1

Hi,

I would like to synchronise the user session on app side with the sync-gateway session. So if the user is still using the App, his session is extended, is there a way to update Sync-Gateway session? I was in couchbase and update the ttl and expiration attribute of the session object:
_sync:session:d0bd4a1f536b5e981ec00b38a035354893c93268
{
“id”: “d0bd4a1f536b5e981ec00b38a035354893c93268”,
“username”: “JRMesa.MmP694n-PiDZ4jK7Yu_pycQ2”,
“expiration”: “2019-04-13T10:18:36.016272478-06:00”,
“ttl”: 6000000000000
}
but it looks like not working.

Thank you in advance for your advice.


#2

I don’t believe you can update it this way by directly manipulating the session object (I presume thats what you were doing).
The TTL is set at the time of session creation (and that sets the expiration time). As you can note, there are no PUT / update session APIs exposed. Tagging @traun if he has some thoughts …


#3

Correct, I tried to manipulate directly the session object in Couchbase… because I did not see any ‘PUT’ :smirk:

If it is not possible to extend a session, is it possible to create a new session and delete the last one, and for my own understanding, is there a link between one user and one session in sync gateway? Thank you.


#4

Hi,

Never mind, I just noticed that if the App update the CB Lite, the sync gateway session is updated so the session will not end.

Thank you!