Hi,
In the app i'm currently developing, my source adapter connects to a web service in order to fetch the data it needs. This web service uses a token that is only valid for 1 hour. I want the user to be able to keep working with an invalid token and that all changes are stored in the local db until he gets a valid token again (when all changes would be synced)
The problem is that once the Rhoconnect gives error 401 after trying to put, post or delete anything, it won't try to repeat that operation in the following sync (even if the sync succeeds).
I'd like the behaviour to be the same as when the user tries to do any operation without having a valid connection; where it will try to put/post/delete until it succeeds.
I can understand why this is the default behaviour for 401 errors, but is there any way to change this?
Thanks,
Rubén
5 Replies
When an error is encountered on the client you need to handle the error in your sync notification callback. By default if you do not handle the error you will encounter the behavior you see here.
Please see this documentation page:
Rhomobile | Synchronization with Rhodes
There is a section there titled "Server error processing on the client". While this document is labeled for 2.2, it also applies to 4.x.
I've found this 4.1 document: http://docs.rhomobile.com/en/4.1.0/api/NewORMModel
There is a method called onSyncCreateError, but one of its params is the array of objects. I'm not sure what to input here or when to call this method, has anyone used this?
Hi Brian,
Thanks, once again I was missing this 2.2 document. However, I feel like its poorly described. I'm trying to get it to work on Javascript with no success. Any idea on how the syntax and usage would be?
Any news on this? I've been trying further by using custom exceptions on the source adapter and using different combination of parameters in the doSync and doSyncSource methods from the RhoconnectClient API with no success.
Ruben,
Is it possible for you to manually try syncing when you read the response code as 401?
Visnupriya R
Kutir Mobility