TF-3336 Make Echo ping of web socket optional

This commit is contained in:
DatDang
2024-12-16 16:25:59 +07:00
committed by Dat H. Pham
parent 809284d54a
commit 414718141e
5 changed files with 44 additions and 2 deletions
@@ -17,6 +17,7 @@ import 'package:tmail_ui_user/features/push_notification/presentation/extensions
import 'package:tmail_ui_user/features/push_notification/presentation/listener/email_change_listener.dart';
import 'package:tmail_ui_user/features/push_notification/presentation/listener/mailbox_change_listener.dart';
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
import 'package:tmail_ui_user/main/utils/app_config.dart';
import 'package:web_socket_channel/web_socket_channel.dart';
class WebSocketController extends PushBaseController {
@@ -79,7 +80,9 @@ class WebSocketController extends PushBaseController {
_retryRemained = 3;
_webSocketChannel = success.webSocketChannel;
_enableWebSocketPush();
_pingWebSocket();
if (AppConfig.isWebSocketEchoPingEnabled) {
_pingWebSocket();
}
_listenToWebSocket();
}
+2
View File
@@ -68,4 +68,6 @@ class AppConfig {
static String get _platformEnv => dotenv.get('PLATFORM', fallback: 'other');
static bool get isSaasPlatForm => _platformEnv.toLowerCase() == saasPlatform;
static bool get isWebSocketEchoPingEnabled => dotenv.get('WS_ECHO_PING', fallback: 'false') == 'true';
}