connect to server, "auth_error"

0 votes

cocos2d-x SDK

test at iPhone simulator!
When I terminate app, and relaunch app, it is easily failed when connect to server!
the code is "1" --> auth_error.
Thanks

asked Mar 3, 2014 in AppWarp by joappdev (20 points)
retagged Mar 11, 2014 by shepAdmin

1 Answer

0 votes
Do you call disconnect before terminating? Otherwise the session is still alive/suspended on the server and if you connect with the same username the server will return 1 error (indicating that the user is already connected and hence the new session is not allowed to use the given name).
answered Mar 3, 2014 by dhruvc (1,099 points)
no, I didn't call. But this may happen if user just enter background and app is terminated by iOS. And then user relaunch app again. What should I do?
If you have set recovery allowance to say 60 seconds, then for unclean disconnects (i.e. the ones in which the client doesn't call the disconnect API) - the server will hold on to your session for 60 seconds allowing you to recover from it. But this also means any new connection using the same username will not be allowed to connect in this period.
One approach could be that you log the time your app closes and then when you relaunch check if the time elapsed is greater than the recovery allowance that you've set. If so - OK. Else wait for that much time before calling connect.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...