chore: 增加 rcp 支持

oneRain 2020-04-13 10:46:49 +08:00
parent 72d65b4fb5
commit aeb063f6f8
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
using System.Threading.Tasks;
using LeanCloud.Realtime.Protocol;
namespace LeanCloud.Realtime.Internal.Controller {
internal class LCIMRcpController : LCIMController {
internal LCIMRcpController(LCIMClient client) : base(client) {
}
#region 消息处理
internal override async Task OnNotification(GenericCommand notification) {
RcpCommand rcp = notification.RcpMessage;
string convId = rcp.Cid;
string msgId = rcp.Id;
long timestamp = rcp.T;
bool isRead = rcp.Read;
string fromId = rcp.From;
LCIMConversation conversation = await Client.GetOrQueryConversation(convId);
if (isRead) {
Client.OnMessageRead?.Invoke(conversation, msgId);
} else {
Client.OnMessageDelivered?.Invoke(conversation, msgId);
}
}
#endregion
}
}