reconnectToRelays method
Future<void>
reconnectToRelays({
- required void onRelayListening(
- String relayUrl,
- dynamic receivedData,
- WebSocketChannel? relayWebSocket
- required void onRelayConnectionError()?,
- required void onRelayConnectionDone(
- String relayUrl,
- WebSocketChannel? relayWebSocket
- required bool retryOnError,
- required bool retryOnClose,
- required bool shouldReconnectToRelayOnNotice,
- required Duration connectionTimeout,
- required bool ignoreConnectionException,
- required bool lazyListeningToRelays,
- bool relayUnregistered = true,
override
Implementation
@override
Future<void> reconnectToRelays({
required void Function(
String relayUrl,
dynamic receivedData,
WebSocketChannel? relayWebSocket,
)? onRelayListening,
required void Function(
String relayUrl,
Object? error,
WebSocketChannel? relayWebSocket,
)? onRelayConnectionError,
required void Function(String relayUrl, WebSocketChannel? relayWebSocket)?
onRelayConnectionDone,
required bool retryOnError,
required bool retryOnClose,
required bool shouldReconnectToRelayOnNotice,
required Duration connectionTimeout,
required bool ignoreConnectionException,
required bool lazyListeningToRelays,
bool relayUnregistered = true,
}) async {
final completer = Completer();
if (relaysList == null || relaysList!.isEmpty) {
throw Exception(
'you need to call the init method before calling this method.',
);
}
for (final relay in relaysList!) {
await _reconnectToRelay(
relayUnregistered: relayUnregistered,
relay: relay,
onRelayListening: onRelayListening,
onRelayConnectionError: onRelayConnectionError,
onRelayConnectionDone: onRelayConnectionDone,
retryOnError: retryOnError,
retryOnClose: retryOnClose,
shouldReconnectToRelayOnNotice: shouldReconnectToRelayOnNotice,
connectionTimeout: connectionTimeout,
ignoreConnectionException: ignoreConnectionException,
lazyListeningToRelays: lazyListeningToRelays,
);
}
completer.complete();
return completer.future;
}