From cc59814b554a6a12d9eea1a5befb8832e0e71de4 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 6 Jul 2024 17:39:19 +0800 Subject: [PATCH] :zap: Optimized websocket --- lib/providers/account.dart | 6 +++--- lib/providers/chat.dart | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/providers/account.dart b/lib/providers/account.dart index 821ed2c..4aae096 100644 --- a/lib/providers/account.dart +++ b/lib/providers/account.dart @@ -13,7 +13,7 @@ import 'package:solian/models/pagination.dart'; import 'package:solian/platform.dart'; import 'package:solian/providers/auth.dart'; import 'package:solian/services.dart'; -import 'package:web_socket_channel/io.dart'; +import 'package:web_socket_channel/web_socket_channel.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; class AccountProvider extends GetxController { @@ -27,7 +27,7 @@ class AccountProvider extends GetxController { RxList notifications = List.empty(growable: true).obs; - IOWebSocketChannel? websocket; + WebSocketChannel? websocket; @override onInit() { @@ -66,7 +66,7 @@ class AccountProvider extends GetxController { isConnecting.value = true; try { - websocket = IOWebSocketChannel.connect(uri); + websocket = WebSocketChannel.connect(uri); await websocket?.ready; } catch (e) { if (!noRetry) { diff --git a/lib/providers/chat.dart b/lib/providers/chat.dart index 45941f8..f1ee758 100644 --- a/lib/providers/chat.dart +++ b/lib/providers/chat.dart @@ -6,13 +6,13 @@ import 'package:get/get.dart'; import 'package:solian/models/packet.dart'; import 'package:solian/providers/auth.dart'; import 'package:solian/services.dart'; -import 'package:web_socket_channel/io.dart'; +import 'package:web_socket_channel/web_socket_channel.dart'; class ChatProvider extends GetxController { RxBool isConnected = false.obs; RxBool isConnecting = false.obs; - IOWebSocketChannel? websocket; + WebSocketChannel? websocket; StreamController stream = StreamController.broadcast(); @@ -36,7 +36,7 @@ class ChatProvider extends GetxController { isConnecting.value = true; try { - websocket = IOWebSocketChannel.connect(uri); + websocket = WebSocketChannel.connect(uri); await websocket?.ready; } catch (e) { if (!noRetry) {