Optimized websocket

This commit is contained in:
LittleSheep 2024-07-06 17:39:19 +08:00
parent b808c76ea3
commit cc59814b55
2 changed files with 6 additions and 6 deletions

View File

@ -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<Notification> notifications =
List<Notification>.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) {

View File

@ -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<NetworkPackage> 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) {