csharp-sdk-upm/Realtime/Conversation/LCIMChatRoom.cs

28 lines
920 B
C#
Raw Normal View History

using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using LeanCloud.Realtime.Protocol;
namespace LeanCloud.Realtime {
public class LCIMChatRoom : LCIMConversation {
2020-03-13 17:22:46 +08:00
public LCIMChatRoom(LCIMClient client) : base(client) {
}
public async Task<int> GetOnlineMembersCount() {
return await GetMembersCount();
}
public async Task<List<string>> GetOnlineMembers(int limit = 50) {
ConvCommand conv = new ConvCommand {
Cid = Id,
Limit = limit
};
GenericCommand request = Client.NewCommand(CommandType.Conv, OpType.Members);
request.ConvMessage = conv;
GenericCommand response = await Client.Connection.SendRequest(request);
List<string> memberList = response.ConvMessage.M.ToList();
return memberList;
}
}
}