The current implementation of hypha rpc cannot handle re-connection properly after disconnected from the server.
Here, we need to have a mechanism to restore connection after disconnecting from the server. Here is a list of points to be considered:
After the initial connection, the client will request for a reconnection_token, and refresh it on a fixed interval
The client should keep trying to reconnect if still not able to connect until it recovers
If the server detected a lost of connection for a given client, it need to pause the communication for the client (i.e. any new function call to that client should be immediately rejected), also if the user launched browser apps for example, those clients should remain and removed until timeout
If the server get a previously connected client (connected using the reconnection_token), the server should restore the previous session. If the reconnection_token expires, the server should reject the client.
The current implementation of hypha rpc cannot handle re-connection properly after disconnected from the server.
Here, we need to have a mechanism to restore connection after disconnecting from the server. Here is a list of points to be considered:
reconnection_token
), the server should restore the previous session. If the reconnection_token expires, the server should reject the client.For reference, this is the server implementation: https://github.com/amun-ai/hypha/blob/main/hypha/websocket.py (to properly handle the reconnection, we might need to update the logic here too)