mirror of
https://github.com/WuKongIM/WuKongIMFlutterSDK
synced 2025-05-28 22:52:20 +00:00
Reconnect when handling connection errors
This commit is contained in:
parent
ab8abdfbbd
commit
6a64a7f145
@ -1,2 +1,6 @@
|
||||
### 1.0.0
|
||||
* first commint
|
||||
* first commint
|
||||
### 1.0.1
|
||||
* update connection
|
||||
### 1.0.2
|
||||
* Reconnect when handling connection errors
|
@ -10,7 +10,7 @@
|
||||
#### 安装
|
||||
```
|
||||
dependencies:
|
||||
wukongimfluttersdk: ^1.0.1
|
||||
wukongimfluttersdk: ^1.0.2
|
||||
```
|
||||
#### 引入
|
||||
```dart
|
||||
|
@ -499,7 +499,7 @@ packages:
|
||||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "1.0.1"
|
||||
version: "1.0.2"
|
||||
x25519:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -32,11 +32,12 @@ class _WKSocket {
|
||||
}
|
||||
}
|
||||
|
||||
void listen(void Function(Uint8List data) onData) {
|
||||
void listen(void Function(Uint8List data) onData, void Function() error) {
|
||||
_socket.listen(onData, onError: (err) {
|
||||
Logs.debug('socket断开了${err.toString()}');
|
||||
}, onDone: () {
|
||||
Logs.debug('socketonDone');
|
||||
error();
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -126,6 +127,11 @@ class WKConnectionManager {
|
||||
_socket?.listen((Uint8List data) {
|
||||
_cutDatas(data);
|
||||
// _decodePacket(data);
|
||||
}, () {
|
||||
isReconnection = true;
|
||||
Future.delayed(const Duration(milliseconds: 1500), () {
|
||||
connect();
|
||||
});
|
||||
});
|
||||
// 发送连接包
|
||||
_sendConnectPacket();
|
||||
@ -205,7 +211,6 @@ class WKConnectionManager {
|
||||
}
|
||||
|
||||
_decodePacket(Uint8List data) {
|
||||
Logs.debug("收到数据->$data");
|
||||
var packet = WKIM.shared.options.proto.decode(data);
|
||||
Logs.debug('解码出包->$packet');
|
||||
if (packet.header.packetType == PacketType.connack) {
|
||||
|
@ -15,7 +15,7 @@ description: wukong IM flutter sdk
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.1
|
||||
version: 1.0.2
|
||||
homepage: https://github.com/WuKongIM/WuKongIMFlutterSDK
|
||||
|
||||
environment:
|
||||
|
Loading…
x
Reference in New Issue
Block a user