From 6711b8a07909452bc61f44c9dd920336fb51b13d Mon Sep 17 00:00:00 2001 From: zsw Date: Fri, 20 Sep 2024 12:05:49 +0800 Subject: [PATCH] socketclient heartbeat --- lib/im/SocketClient.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/im/SocketClient.dart b/lib/im/SocketClient.dart index 683043da..4ec2a8e0 100644 --- a/lib/im/SocketClient.dart +++ b/lib/im/SocketClient.dart @@ -54,11 +54,11 @@ class SocketClient { } heartbeat() { - Timer.periodic(const Duration(milliseconds: 3000), (timer) { + Timer.periodic(const Duration(milliseconds: 30000), (timer) { debugPrint("heartbeat: ${DateTime.now().millisecondsSinceEpoch}"); Uint8List data = utf8.encode(jsonEncode({"heartbeat": DateTime.now().millisecondsSinceEpoch})); - MsgData msgData = MsgData(to: "0", from: userId, type: MsgType.TEXT, data: data); - final proto2 = Proto(5, 1, msgData.writeToBuffer()); + MsgData msgData = MsgData(from: userId, type: MsgType.TEXT, data: data); + final proto2 = Proto(3, 1, msgData.writeToBuffer()); _socket.add(proto2.toBytes()); }); }