tryReconnect static method

void tryReconnect(
  1. ZapConsumer client
)

Implementation

static void tryReconnect(ZapConsumer client) async {
  client._shareConnectionState(ConnectionState.retrying);
  await client.disconnect();
  final uri = client.uri;
  late WebSocketChannel channel;
  try {
    channel = WebSocketChannel.connect(uri);
  } catch (e) {
    log("Unable to reconnect", level: 800);
    return;
  }
  final session = ChannelSession.fromWebSocketChannel(channel, uri);
  client._updateSession(session);
  client.start();
}