chore: 完善 ack 和 read

oneRain 2020-04-15 16:47:01 +08:00
parent 6df8ea80b7
commit 7cdc768a5a
1 changed files with 9 additions and 6 deletions

View File

@ -151,9 +151,9 @@ namespace LeanCloud.Realtime.Internal.Controller {
Cid = convId, Cid = convId,
Mid = msgId Mid = msgId
}; };
GenericCommand request = NewCommand(CommandType.Ack); GenericCommand command = NewCommand(CommandType.Ack);
request.AckMessage = ack; command.AckMessage = ack;
await Client.Connection.SendRequest(request); await Client.Connection.SendCommand(command);
} }
/// <summary> /// <summary>
@ -171,9 +171,9 @@ namespace LeanCloud.Realtime.Internal.Controller {
Timestamp = msg.SentTimestamp Timestamp = msg.SentTimestamp
}; };
read.Convs.Add(tuple); read.Convs.Add(tuple);
GenericCommand request = NewCommand(CommandType.Read, OpType.Open); GenericCommand command = NewCommand(CommandType.Read);
request.ReadMessage = read; command.ReadMessage = read;
await Client.Connection.SendRequest(request); await Client.Connection.SendCommand(command);
} }
#endregion #endregion
@ -182,6 +182,9 @@ namespace LeanCloud.Realtime.Internal.Controller {
internal override async Task OnNotification(GenericCommand notification) { internal override async Task OnNotification(GenericCommand notification) {
DirectCommand direct = notification.DirectMessage; DirectCommand direct = notification.DirectMessage;
// 通知服务端已接收
_ = Ack(direct.Cid, direct.Id);
// 反序列化消息
LCIMMessage message; LCIMMessage message;
if (direct.HasBinaryMsg) { if (direct.HasBinaryMsg) {
// 二进制消息 // 二进制消息