Skip to content

Commit 838cc25

Browse files
Merge pull request #84 from sendbird/v3.2.19
Add 3.2.19.
2 parents 730e4c1 + 1be11eb commit 838cc25

File tree

5 files changed

+37
-17
lines changed

5 files changed

+37
-17
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [3.2.19] - Oct 13, 2023
2+
3+
- Fixed the bug regarding WebSocket error handling.
4+
15
## [3.2.18] - Sep 18, 2023
26

37
- Fixed the bug regarding uploadSizeLimit

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
[![Platform](https://img.shields.io/badge/platform-flutter-blue)](https://flutter.dev/)
44
[![Language](https://img.shields.io/badge/language-dart-blue)](https://dart.dev/)
55

6+
> **Warning**
7+
> Sendbird Chat SDK v3 for Flutter is no longer supported as a new version is released. Check out our latest Chat SDK v4 [here](https://pub.dev/packages/sendbird_chat_sdk)
8+
69
## Table of contents
710

811
1. [Introduction](#introduction)
@@ -38,8 +41,8 @@ Through Chat SDK for flutter, you can efficiently integrate real-time chat into
3841
The minimum requirements for Chat SDK for Flutter are:
3942

4043
- Xcode or Android studio
41-
- Dart 2.10.4 or above
42-
- Flutter 1.22.0 or higher
44+
- Dart 2.18.0 or above
45+
- Flutter 3.3.0 or higher
4346

4447
## Getting started
4548

@@ -71,7 +74,7 @@ Installing the Chat SDK is a simple process if you’re familiar with using exte
7174

7275
```yaml
7376
dependencies:
74-
sendbird_sdk: ^3.2.18
77+
sendbird_sdk: ^3.2.19
7578
```
7679
7780
- Run `flutter pub get` command in your project directory.

lib/sdk/internal/sendbird_sdk_internal.dart

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import 'package:flutter/foundation.dart' show kIsWeb;
2525

2626
import '../../constant/contants.dart';
2727

28-
const sdk_version = '3.2.18';
28+
const sdk_version = '3.2.19';
2929
const platform = 'flutter';
3030

3131
/// This allows a value of type T or T? to be treated as a value of type T?.
@@ -274,20 +274,31 @@ class SendbirdSdkInternal with WidgetsBindingObserver {
274274
final fullWsHost = wsHostUrl + '/?' + Uri(queryParameters: params).query;
275275

276276
logger.i('websocket connecting.. ');
277-
try {
277+
runZonedGuarded(() async {
278278
await _webSocket?.connect(fullWsHost);
279-
} catch (e) {
279+
}, (error, stack) {
280+
if (_loginCompleter != null && !_loginCompleter!.isCompleted) {
281+
_loginCompleter!.completeError(error);
282+
}
283+
280284
_state.connecting = false;
281285
_state.reconnecting = false;
282286
_loginCompleter = null;
283287
_forceReconnect = false;
284-
rethrow;
285-
}
288+
});
286289

287290
final user = await _loginCompleter!.future.timeout(
288291
Duration(seconds: options.connectionTimeout), onTimeout: () async {
289292
logger.e('login timeout');
290293
throw LoginTimeoutError();
294+
}).onError((error, stackTrace) {
295+
if (error is SBError) {
296+
throw error;
297+
} else if (error is Exception) {
298+
throw WebSocketError(message: error.toString());
299+
} else {
300+
throw WebSocketConnectionFailed();
301+
}
291302
});
292303

293304
logger.i('websocket connected and get user from sendbird server');

lib/services/network/websocket_client.dart

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,20 @@ class WebSocketClient {
9595

9696
_stopPing();
9797

98-
try {
98+
bool result = false;
99+
runZonedGuarded(() async {
99100
//This should trigger callback for Done()
100101
//And set _connected to false before returning from close
101102
await _socket?.sink.close(code, reason);
102-
_subscription?.cancel();
103-
_socket = null;
104103
logger.i('Socket closed ' + reason);
105-
return true;
106-
} catch (e) {
107-
onReceiveError(e);
108-
return false;
109-
}
104+
result = true;
105+
}, (error, stack) {
106+
onReceiveError(error);
107+
});
108+
109+
_subscription?.cancel();
110+
_socket = null;
111+
return result;
110112
}
111113

112114
void send(String data) {

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: sendbird_sdk
22
description: The Flutter SDK for Sendbird Chat brings modern messenger chat features to your iOS and Android deployments
3-
version: 3.2.18
3+
version: 3.2.19
44
homepage: https://www.sendbird.com
55
repository: https://www.github.com/sendbird/sendbird-sdk-flutter
66
documentation: https://sendbird.com/docs/chat/v3/flutter/quickstart/send-first-message

0 commit comments

Comments
 (0)