Skip to content

Reconnection State not coming in iOS #415

@JayS0223

Description

@JayS0223

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

  1. In android it first goes in disconnected state and then reconnection state.
  2. 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions