Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Connection State Recovery #763

Open
ricardopereira opened this issue Mar 13, 2024 · 0 comments
Open

Implement Connection State Recovery #763

ricardopereira opened this issue Mar 13, 2024 · 0 comments

Comments

@ricardopereira
Copy link

Is your feature request related to a problem? Please describe.
Yes, the problem arises when mobile applications experience temporary network disconnections. Currently, the library doesn't support the connection state recovery feature that was introduced in the Socket.io JavaScript library version. This leads to a loss of vital connection state, which can degrade the user experience in mobile apps that rely on real-time communications.

Describe the solution you'd like
I suggest implementing the connection state recovery feature that is present in the JavaScript library. This feature allows a client to reconnect after a temporary disconnection and seamlessly restore its previous state, including id, rooms, data, and missed packets. Reference: socketio/socket.io@54d5ee0

Describe alternatives you've considered
In the absence of this feature, we've considered developing custom mechanisms to handle reconnection and state restoration, but this requires significant effort and is not as reliable or standardized as having the functionality built directly into the library.

Additional context
This feature is already implemented in the JavaScript version of the library. Here's an example of how the feature is used in JavaScript:

import { Server } from "socket.io";

const io = new Server({
  connectionStateRecovery: {
    // default values
    maxDisconnectionDuration: 2 * 60 * 1000,
    skipMiddlewares: true,
  },
});

io.on("connection", (socket) => {
  console.log(socket.recovered); // whether the state was recovered or not
});

Having this feature in the mobile libraries would align them with the web version and provide a consistent and reliable user experience across all platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant