|
|
|
@ -55,8 +55,9 @@ class SocketClient {
|
|
|
|
|
|
|
|
|
|
heartbeat() { |
|
|
|
|
Timer.periodic(const Duration(milliseconds: 30000), (timer) { |
|
|
|
|
debugPrint("heartbeat: ${DateTime.now().millisecondsSinceEpoch}"); |
|
|
|
|
Uint8List data = utf8.encode(jsonEncode({"heartbeat": DateTime.now().millisecondsSinceEpoch})); |
|
|
|
|
int milliseTime = DateTime.now().millisecondsSinceEpoch; |
|
|
|
|
debugPrint("heartbeat: ${milliseTime}"); |
|
|
|
|
Uint8List data = utf8.encode(jsonEncode({"heartbeat": milliseTime})); |
|
|
|
|
MsgData msgData = MsgData(from: userId, type: MsgType.TEXT, data: data); |
|
|
|
|
final proto2 = Proto(3, 1, msgData.writeToBuffer()); |
|
|
|
|
_socket.add(proto2.toBytes()); |
|
|
|
|