FailoverProxy constructor
Implementation
FailoverProxy(List<String> urls) {
// Validate url input
if (urls.isEmpty) {
throw ValidationException('Url array must not be empty');
}
// Validate each entry in the url array
for (final url in urls) {
if (url.endsWith('/')) {
throw ValidationException("`url` cannot end with '/', got: $url");
}
if (!url.startsWith('https://') && !url.startsWith('http://')) {
throw ValidationException(
"`url` must start with 'https://' or 'http://', got: $url",
);
}
}
// Initializes _endpointArray with an object Array containing
// 'url' and 'wsUrl' props
_endpointArray = appendWsUrls(urls);
_workingIndex = 0;
}