-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
At the moment when the server returns an error, reconnection does not work. The problem is in the code section (see below).
The problem is with "return" after calling onError.
File: client.dart
if (data.statusCode < 200 || data.statusCode >= 300) {
String responseBody = await data.stream.bytesToString();
if (onError != null) {
Map<String, dynamic>? errorDetails;
try {
errorDetails = jsonDecode(responseBody);
} catch (e) {
errorDetails = {'rawBody': responseBody};
}
onError(
EventFluxException(
statusCode: data.statusCode,
reasonPhrase: data.reasonPhrase,
message: errorDetails.toString().isEmpty
? data.reasonPhrase
: errorDetails.toString(),
),
);
}
return;
}
if (autoReconnect && data.statusCode != 200) {
_attemptReconnectIfNeeded(
_isExplicitDisconnect,
autoReconnect,
type,
url,
header,
onSuccessCallback,
onError: onError,
onConnectionClose: onConnectionClose,
httpClient: httpClient,
body: body,
files: files,
multipartRequest: multipartRequest,
);
return;
}
Metadata
Metadata
Assignees
Labels
No labels