-
Notifications
You must be signed in to change notification settings - Fork 195
Open
Description
As per events mentioned in the example, when network gets disconnected the state sould be reconnecting but "Disconnected" state is called first in iOS.
Now I am providing the code for the events which I have used:
_socket.io.on('reconnect_attempt', (_) {
Fluttertoast.showToast(
msg: "Current state of room Reconninting",
toastLength: Toast.LENGTH_LONG, // LONG lasts around 5 seconds
gravity: ToastGravity.BOTTOM,
);
print("Socket-lol Attempting to reconnect...");
onReconnection?.call();
});
_socket.io.on('close', (_) {
print("Socket-lol closed");
});
_socket.io.on('reconnect_failed', (_) {
// onDisconnected?.call();
Fluttertoast.showToast(
msg: "Current state of room failed",
toastLength: Toast.LENGTH_LONG, // LONG lasts around 5 seconds
gravity: ToastGravity.BOTTOM,
);
print("Socket-lol Reconnection failed after max attempts");
});
_socket.io.on(('reconnect'), (_) {
print("Socket-lol Reconnection state");
});
_socket.io.on('reconnect_error', (error) {
print("Current state of room reconnect error ${error}");
// Fluttertoast.showToast(
// msg: "Current state of room reconnect error ${error}",
// toastLength: Toast.LENGTH_LONG, // LONG lasts around 5 seconds
// gravity: ToastGravity.BOTTOM,
// );
print("Socket-lol Reconnection error: $error");
});
But the main issue is that
- In android it first goes in disconnected state and then reconnection state.
- When it comes to iOS it again goes into disconnected state, but after that reconnection state is not called.
socket_io_client: 3.0.2
Please let me know the solution for the same.
Metadata
Metadata
Assignees
Labels
No labels