onReconnect method

void onReconnect(
  1. void callback(
    1. OnReconnectionCallback reconnection
    )
)

Register a function to call as the first step of reconnecting. This function can call methods which will be executed before any other outstanding methods. For example, this can be used to re-establish the appropriate authentication context on the connection. callback: The function to call. It will be called with a single argument, the connection object that is reconnecting.

Implementation

void onReconnect(
    void Function(OnReconnectionCallback reconnection) callback) {
  var id = _generateUID(16);
  var onReconnectCallback =
      OnReconnectionCallback(ddpClient: this, id: id, callback: callback);
  _onReconnectCallbacks[id] = onReconnectCallback;
}