handleRequest method

  1. @override
void handleRequest(
  1. RequestState requestState
)
override

If you request anything from the nostr network put it here and the relay jit manager will try to find the right relay and use it if no relay is found the request will be blasted to all connected relays (on start seed Relays)

Implementation

@override
void handleRequest(RequestState requestState) async {
  await relayManagerLight.seedRelaysConnected;

  // explicit relays get every filter: one none of them took must not end the
  // request before the next ones are sent. Other strategies let it end early
  final holdOpen = requestState.request.explicitRelays?.isNotEmpty ?? false;
  if (holdOpen) relayManagerLight.beginPendingConnection(requestState);
  try {
    await _handleFilters(requestState);
  } finally {
    if (holdOpen) relayManagerLight.endPendingConnection(requestState);
  }

  requestState.closeIfNoRelays();
}