I have already set up the server and prepared the cloud code. I have several questions and would like to consult you all:
- Do I need to manually disconnect when the user logs out? When I tried to call the disconnect method, the client would immediately reconnect. If I don’t call the disconnect method, when the user logs in with another account, the subscriptions all work fine. It’s just that the WebSocket remains in a connected state throughout the process of the user logging out and then logging back in. Should the WebSocket connection state be maintained when the user logs out?
- I have listened for the ws_disconnect event in the cloud code. If the user disconnects, it will update that the user is offline. If it’s a manual disconnection, the update can indeed be done. However, the client will reconnect and the server considers this user to be logged in during the beforeConnect process.
- When the app goes to the background and then returns to the foreground, do developers not need to care about the connection state of LiveQuery during these processes?
- If the connection is disconnected due to network issues, is there a limit to the number of reconnection attempts, or will it keep trying to reconnect?