diff --git a/Common/Common/Exception/LCException.cs b/Common/Common/Exception/LCException.cs
index 1daebab..7665d5c 100644
--- a/Common/Common/Exception/LCException.cs
+++ b/Common/Common/Exception/LCException.cs
@@ -2,18 +2,18 @@
namespace LeanCloud {
///
- /// LeanCloud 异常
+ /// LeanCloud Exceptions
///
public class LCException : Exception {
///
- /// 错误码
+ /// Error code
///
public int Code {
get; set;
}
///
- /// 错误信息
+ /// Error message
///
public new string Message {
get; set;
diff --git a/Common/Common/Json/LCJsonUtils.cs b/Common/Common/Json/LCJsonUtils.cs
index 25ec9fd..ad368ad 100644
--- a/Common/Common/Json/LCJsonUtils.cs
+++ b/Common/Common/Json/LCJsonUtils.cs
@@ -3,7 +3,7 @@ using System.Threading.Tasks;
namespace LeanCloud.Common {
///
- /// 为 Json 解析提供异步接口
+ /// Serialize and deserialize
///
public static class LCJsonUtils {
public static async Task SerializeObjectAsync(object obj) {
diff --git a/Common/Common/Log/LCLogLevel.cs b/Common/Common/Log/LCLogLevel.cs
index f43aaf5..fd994fd 100644
--- a/Common/Common/Log/LCLogLevel.cs
+++ b/Common/Common/Log/LCLogLevel.cs
@@ -1,19 +1,7 @@
namespace LeanCloud {
- ///
- /// 日志级别
- ///
public enum LCLogLevel {
- ///
- /// 调试级别
- ///
Debug,
- ///
- /// 警告级别
- ///
Warn,
- ///
- /// 错误级别
- ///
Error,
}
}
diff --git a/Common/Common/Log/LCLogger.cs b/Common/Common/Log/LCLogger.cs
index 1ffbcac..d0611d0 100644
--- a/Common/Common/Log/LCLogger.cs
+++ b/Common/Common/Log/LCLogger.cs
@@ -3,11 +3,11 @@ using System.Text;
namespace LeanCloud {
///
- /// 日志类
+ /// Logger
///
public static class LCLogger {
///
- /// 日志回调接口,方便开发者调试
+ /// Configures the logger.
///
/// The log delegate.
public static Action LogDelegate {
diff --git a/LiveQuery/LiveQuery/Internal/LCLiveQueryConnection.cs b/LiveQuery/LiveQuery/Internal/LCLiveQueryConnection.cs
index cfeeb34..d2e4466 100644
--- a/LiveQuery/LiveQuery/Internal/LCLiveQueryConnection.cs
+++ b/LiveQuery/LiveQuery/Internal/LCLiveQueryConnection.cs
@@ -10,45 +10,28 @@ using LeanCloud.Realtime.Internal.Connection;
namespace LeanCloud.LiveQuery.Internal {
public class LCLiveQueryConnection {
- ///
- /// 发送超时
- ///
private const int SEND_TIMEOUT = 10000;
///
- /// 最大重连次数,超过后重置 Router 缓存后再次尝试重连
+ /// After exceeding this limit, will reset the Router cache and try to reconnect again.
///
private const int MAX_RECONNECT_TIMES = 10;
- ///
- /// 重连间隔
- ///
private const int RECONNECT_INTERVAL = 10000;
- ///
- /// 子协议
- ///
private const string SUB_PROTOCOL = "lc.json.3";
- ///
- /// 通知事件
- ///
+
internal Action> OnNotification;
- ///
- /// 断线事件
- ///
internal Action OnDisconnect;
- ///
- /// 重连成功事件
- ///
internal Action OnReconnected;
internal string id;
///
- /// 请求回调缓存
+ /// Request callback cache
///
private readonly Dictionary>> responses;
@@ -90,7 +73,7 @@ namespace LeanCloud.LiveQuery.Internal {
}
///
- /// 重置连接
+ /// Resets connection
///
///
internal async Task Reset() {
@@ -108,7 +91,7 @@ namespace LeanCloud.LiveQuery.Internal {
}
///
- /// 发送请求,会在收到应答后返回
+ /// Sends the request. It will return after receiving a response.
///
///
///
@@ -127,7 +110,7 @@ namespace LeanCloud.LiveQuery.Internal {
}
///
- /// 发送文本消息
+ /// Sends text message.
///
///
///
@@ -142,7 +125,7 @@ namespace LeanCloud.LiveQuery.Internal {
}
///
- /// 关闭连接
+ /// Closes the connection.
///
///
internal async Task Close() {
diff --git a/LiveQuery/LiveQuery/Internal/LCLiveQueryHeartBeat.cs b/LiveQuery/LiveQuery/Internal/LCLiveQueryHeartBeat.cs
index 6dd5262..d3a339c 100644
--- a/LiveQuery/LiveQuery/Internal/LCLiveQueryHeartBeat.cs
+++ b/LiveQuery/LiveQuery/Internal/LCLiveQueryHeartBeat.cs
@@ -6,7 +6,7 @@ using System.Collections.Generic;
namespace LeanCloud.LiveQuery.Internal {
///
- /// LiveQuery 心跳控制器
+ /// LiveQuery heartbeat controller
///
internal class LCLiveQueryHeartBeat : LCHeartBeat {
private readonly LCLiveQueryConnection connection;
diff --git a/LiveQuery/LiveQuery/LCLiveQuery.cs b/LiveQuery/LiveQuery/LCLiveQuery.cs
index c6f96a6..da077bb 100644
--- a/LiveQuery/LiveQuery/LCLiveQuery.cs
+++ b/LiveQuery/LiveQuery/LCLiveQuery.cs
@@ -13,27 +13,27 @@ namespace LeanCloud.LiveQuery {
///
public class LCLiveQuery {
///
- /// 新对象创建事件
+ /// A new LCObject which fulfills the LCQuery you subscribe is created.
///
public Action OnCreate;
///
- /// 对象更新事件
+ /// An existing LCObject which fulfills the LCQuery you subscribe is updated.
///
public Action> OnUpdate;
///
- /// 对象被删除
+ /// An existing LCObject which fulfills the LCQuery you subscribe is deleted.
///
public Action OnDelete;
///
- /// 有新的满足条件的对象产生
+ /// An existing LCObject which doesn't fulfill the LCQuery is updated and now it fulfills the LCQuery.
///
public Action> OnEnter;
///
- /// 不再满足条件
+ /// An existing LCObject which fulfills the LCQuery is updated and now it doesn't fulfill the LCQuery.
///
public Action> OnLeave;
///
- /// 当一个用户登录成功
+ /// A LCUser logged in successfully.
///
public Action OnLogin;
@@ -55,10 +55,7 @@ namespace LeanCloud.LiveQuery {
private static readonly string DeviceId = Guid.NewGuid().ToString();
- ///
- /// 订阅
- ///
- ///
+
public async Task Subscribe() {
// TODO 判断当前连接情况
if (connection == null) {
@@ -92,10 +89,6 @@ namespace LeanCloud.LiveQuery {
}
}
- ///
- /// 取消订阅
- ///
- ///
public async Task Unsubscribe() {
Dictionary data = new Dictionary {
{ "id", DeviceId },
diff --git a/Realtime/Realtime.Test/Message.cs b/Realtime/Realtime.Test/Message.cs
index d69ce66..fefb78f 100644
--- a/Realtime/Realtime.Test/Message.cs
+++ b/Realtime/Realtime.Test/Message.cs
@@ -9,9 +9,6 @@ using LeanCloud.Realtime;
using static NUnit.Framework.TestContext;
-///
-/// Emoji 消息
-///
class EmojiMessage : LCIMTypedMessage {
public const int EmojiMessageType = 1;
diff --git a/Realtime/Realtime/Conversation/LCIMChatRoom.cs b/Realtime/Realtime/Conversation/LCIMChatRoom.cs
index e5f89b3..6bccd42 100644
--- a/Realtime/Realtime/Conversation/LCIMChatRoom.cs
+++ b/Realtime/Realtime/Conversation/LCIMChatRoom.cs
@@ -5,25 +5,21 @@ using System.Threading.Tasks;
namespace LeanCloud.Realtime {
///
- /// 聊天室
+ /// Chatroom
///
public class LCIMChatRoom : LCIMConversation {
public LCIMChatRoom(LCIMClient client) :
base(client) {
}
- ///
- /// 获取在线用户数量
- ///
- ///
public async Task GetOnlineMembersCount() {
return await GetMembersCount();
}
///
- /// 获取在线用户
+ /// Gets online members.
///
- ///
+ /// Query limit, defaults to 50.
///
public async Task> GetOnlineMembers(int limit = 50) {
return await Client.ConversationController.GetOnlineMembers(Id, limit);
diff --git a/Realtime/Realtime/Conversation/LCIMConversation.cs b/Realtime/Realtime/Conversation/LCIMConversation.cs
index b0f4015..91a0623 100644
--- a/Realtime/Realtime/Conversation/LCIMConversation.cs
+++ b/Realtime/Realtime/Conversation/LCIMConversation.cs
@@ -7,32 +7,32 @@ using LeanCloud.Storage;
namespace LeanCloud.Realtime {
///
- /// 普通对话
+ /// Conversation
///
public class LCIMConversation {
///
- /// 对话 Id
+ /// The ID of this conversation
///
public string Id {
get; internal set;
}
///
- /// 是否唯一
+ /// Indicates whether this conversation is normal and unique. The uniqueness is based on the members when creating.
///
public bool Unique {
get; internal set;
}
///
- /// 唯一 Id
+ /// If this conversation is unique, then it will have a unique ID.
///
public string UniqueId {
get; internal set;
}
///
- /// 对话名称
+ /// The name of this conversation.
///
public string Name {
get {
@@ -44,14 +44,14 @@ namespace LeanCloud.Realtime {
}
///
- /// 创建者 Id
+ /// The creator of this conversation.
///
public string CreatorId {
get; set;
}
///
- /// 成员 Id
+ /// The members of this conversation.
///
public ReadOnlyCollection MemberIds {
get {
@@ -60,7 +60,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 静音成员 Id
+ /// Muted members of this conversation.
///
public ReadOnlyCollection MutedMemberIds {
get {
@@ -69,42 +69,42 @@ namespace LeanCloud.Realtime {
}
///
- /// 未读消息数量
+ /// The count of the unread messages.
///
public int Unread {
get; internal set;
}
///
- /// 最新的一条消息
+ /// The last message in this conversation.
///
public LCIMMessage LastMessage {
get; internal set;
}
///
- /// 创建时间
+ /// The created date of this conversation.
///
public DateTime CreatedAt {
get; internal set;
}
///
- /// 更新时间
+ /// The last updated date of this conversation.
///
public DateTime UpdatedAt {
get; internal set;
}
///
- /// 最新送达消息时间戳
+ /// The last timestamp of the delivered message.
///
public long LastDeliveredTimestamp {
get; internal set;
}
///
- /// 最新送达消息时间
+ /// The last date of the delivered message.
///
public DateTime LastDeliveredAt {
get {
@@ -114,14 +114,14 @@ namespace LeanCloud.Realtime {
}
///
- /// 最新已读消息时间戳
+ /// The last timestamp of the message which has been read by other clients.
///
public long LastReadTimestamp {
get; internal set;
}
///
- /// 最新已读消息时间
+ /// The last date of the message which has been read by other clients.
///
public DateTime LastReadAt {
get {
@@ -131,9 +131,9 @@ namespace LeanCloud.Realtime {
}
///
- /// 设置/获取对话属性
+ /// Custom attributes.
///
- ///
+ /// Custom attribute name.
///
public object this[string key] {
get {
@@ -145,7 +145,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 是否已静音
+ /// Indicates whether offline notifications about this conversation has been muted.
///
public bool IsMute {
get; private set;
@@ -170,7 +170,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 获取对话人数,或暂态对话的在线人数
+ /// The count of members of this conversation.
///
///
public async Task GetMembersCount() {
@@ -178,7 +178,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 将该会话标记为已读
+ /// Mark the last message of this conversation as read.
///
///
///
@@ -191,9 +191,9 @@ namespace LeanCloud.Realtime {
}
///
- /// 修改对话属性
+ /// Update attributes of this conversation.
///
- ///
+ /// Attributes to update.
///
public async Task UpdateInfo(Dictionary attributes) {
if (attributes == null || attributes.Count == 0) {
@@ -206,9 +206,9 @@ namespace LeanCloud.Realtime {
}
///
- /// 添加用户到对话
+ /// Adds members to this conversation.
///
- /// 用户 Id
+ /// Member list.
///
public virtual async Task AddMembers(IEnumerable clientIds) {
if (clientIds == null || clientIds.Count() == 0) {
@@ -220,9 +220,9 @@ namespace LeanCloud.Realtime {
}
///
- /// 删除用户
+ /// Removes members from this conversation.
///
- /// 用户 Id
+ /// Member list.
///
public async Task RemoveMembers(IEnumerable removeIds) {
if (removeIds == null || removeIds.Count() == 0) {
@@ -234,7 +234,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 加入对话
+ /// Joins this conversation.
///
///
public async Task Join() {
@@ -249,7 +249,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 离开对话
+ /// Leaves this conversation.
///
///
public async Task Quit() {
@@ -261,9 +261,9 @@ namespace LeanCloud.Realtime {
}
///
- /// 发送消息
+ /// Sends a message in this conversation.
///
- ///
+ /// The message to send.
///
public async Task Send(LCIMMessage message,
LCIMMessageSendOptions options = null) {
@@ -279,7 +279,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 静音
+ /// Turns off the offline notifications of this conversation.
///
///
public async Task Mute() {
@@ -288,7 +288,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 取消静音
+ /// Turns on the offline notifications of this conversation.
///
///
public async Task Unmute() {
@@ -297,9 +297,9 @@ namespace LeanCloud.Realtime {
}
///
- /// 禁言
+ /// Mutes members of this conversatino.
///
- ///
+ /// Member list.
///
public async Task MuteMembers(IEnumerable clientIds) {
if (clientIds == null || clientIds.Count() == 0) {
@@ -313,9 +313,9 @@ namespace LeanCloud.Realtime {
}
///
- /// 取消禁言
+ /// Unmutes members of this conversatino.
///
- ///
+ /// Member list.
///
public async Task UnmuteMembers(IEnumerable clientIds) {
if (clientIds == null || clientIds.Count() == 0) {
@@ -329,9 +329,9 @@ namespace LeanCloud.Realtime {
}
///
- /// 将用户加入黑名单
+ /// Adds members to the blocklist of this conversation.
///
- ///
+ /// Member list.
///
public async Task BlockMembers(IEnumerable clientIds) {
if (clientIds == null || clientIds.Count() == 0) {
@@ -341,9 +341,9 @@ namespace LeanCloud.Realtime {
}
///
- /// 将用户移除黑名单
+ /// Removes members from the blocklist of this conversation.
///
- ///
+ /// Member list.
///
public async Task UnblockMembers(IEnumerable clientIds) {
if (clientIds == null || clientIds.Count() == 0) {
@@ -353,9 +353,9 @@ namespace LeanCloud.Realtime {
}
///
- /// 撤回消息
+ /// Recalls a sent message.
///
- ///
+ /// The message to recall.
///
public async Task RecallMessage(LCIMMessage message) {
if (message == null) {
@@ -365,10 +365,10 @@ namespace LeanCloud.Realtime {
}
///
- /// 修改消息
+ /// Updates a sent message.
///
- ///
- ///
+ /// The message to update.
+ /// The updated message.
///
public async Task UpdateMessage(LCIMMessage oldMessage, LCIMMessage newMessage) {
if (oldMessage == null) {
@@ -381,10 +381,10 @@ namespace LeanCloud.Realtime {
}
///
- /// 更新对话中成员的角色
+ /// Updates the role of a member of this conversation.
///
- ///
- ///
+ /// The member to update.
+ /// The new role of the member.
///
public async Task UpdateMemberRole(string memberId, string role) {
if (string.IsNullOrEmpty(memberId)) {
@@ -397,7 +397,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 获取对话中成员的角色(只返回管理员)
+ /// Gets all member roles.
///
///
public async Task> GetAllMemberInfo() {
@@ -405,9 +405,9 @@ namespace LeanCloud.Realtime {
}
///
- /// 获取对话中指定成员的角色
+ /// Gets the role of a specific member.
///
- ///
+ /// The member to query.
///
public async Task GetMemberInfo(string memberId) {
if (string.IsNullOrEmpty(memberId)) {
@@ -423,10 +423,10 @@ namespace LeanCloud.Realtime {
}
///
- /// 查询禁言用户
+ /// Queries muted members.
///
- ///
- ///
+ /// Limits the number of returned results.
+ /// Can be used for pagination with the limit parameter.
///
public async Task QueryMutedMembers(int limit = 10,
string next = null) {
@@ -434,10 +434,10 @@ namespace LeanCloud.Realtime {
}
///
- /// 查询黑名单用户
+ /// Queries blocked members.
///
- /// 限制
- /// 其实用户 Id
+ /// Limits the number of returned results.
+ /// Can be used for pagination with the limit parameter.
///
public async Task QueryBlockedMembers(int limit = 10,
string next = null) {
@@ -445,13 +445,13 @@ namespace LeanCloud.Realtime {
}
///
- /// 查询聊天记录
+ /// Retrieves messages.
///
- /// 起点
- /// 终点
- /// 查找方向
- /// 限制
- /// 消息类型
+ /// Start message ID.
+ /// End message ID.
+ /// Query direction (defaults to NewToOld).
+ /// Limits the number of returned results. Its default value is 20.
+ /// The message type to query. The default value is 0 (text message).
///
public async Task> QueryMessages(LCIMMessageQueryEndpoint start = null,
LCIMMessageQueryEndpoint end = null,
@@ -462,7 +462,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 获取会话已收/已读时间戳
+ /// Fetches receipt timestamp.
///
///
public async Task FetchReciptTimestamps() {
diff --git a/Realtime/Realtime/Conversation/LCIMConversationMemberInfo.cs b/Realtime/Realtime/Conversation/LCIMConversationMemberInfo.cs
index 5809dec..48e4324 100644
--- a/Realtime/Realtime/Conversation/LCIMConversationMemberInfo.cs
+++ b/Realtime/Realtime/Conversation/LCIMConversationMemberInfo.cs
@@ -1,18 +1,9 @@
namespace LeanCloud.Realtime {
public class LCIMConversationMemberInfo {
- ///
- /// 群主
- ///
public const string Owner = "Owner";
- ///
- /// 管理员
- ///
public const string Manager = "Manager";
- ///
- /// 成员
- ///
public const string Member = "Member";
public string ConversationId {
diff --git a/Realtime/Realtime/Conversation/LCIMConversationQuery.cs b/Realtime/Realtime/Conversation/LCIMConversationQuery.cs
index 700ba8d..bc66d2e 100644
--- a/Realtime/Realtime/Conversation/LCIMConversationQuery.cs
+++ b/Realtime/Realtime/Conversation/LCIMConversationQuery.cs
@@ -17,7 +17,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 等于
+ /// The value corresponding to key is equal to value, or the array corresponding to key contains value.
///
///
///
@@ -29,7 +29,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 不等于
+ /// The value corresponding to key is not equal to value, or the array corresponding to key does not contain value.
///
///
///
@@ -41,7 +41,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 包含
+ /// Values contains value corresponding to key, or values contains at least one element in the array corresponding to key.
///
///
///
@@ -53,7 +53,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 包含全部
+ /// The array corresponding to key contains all elements in values.
///
///
///
@@ -65,7 +65,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 存在
+ /// The attribute corresponding to key exists.
///
///
///
@@ -75,7 +75,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 不存在
+ /// The attribute corresponding to key does not exist.
///
///
///
@@ -85,7 +85,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 长度等于
+ /// The size of the array corresponding to key is equal to size.
///
///
///
@@ -97,7 +97,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 大于
+ /// The value corresponding to key is greater than value.
///
///
///
@@ -109,7 +109,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 大于等于
+ /// The value corresponding to key is greater than or equal to value.
///
///
///
@@ -121,7 +121,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 小于
+ /// The value corresponding to key is less than value.
///
///
///
@@ -133,7 +133,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 小于等于
+ /// The value corresponding to key is less than or equal to value.
///
///
///
@@ -145,7 +145,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 前缀
+ /// The string corresponding to key has a prefix.
///
///
///
@@ -157,7 +157,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 后缀
+ /// The string corresponding to key has a suffix.
///
///
///
@@ -168,7 +168,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 字符串包含
+ /// The string corresponding to key has a subString.
///
///
///
@@ -179,9 +179,9 @@ namespace LeanCloud.Realtime {
}
///
- /// 按 key 升序
+ /// The ascending order by the value corresponding to key.
///
- ///
+ /// Multi-field sorting is supported with comma.
///
public LCIMConversationQuery OrderBy(string key) {
Condition.OrderByAscending(key);
@@ -189,9 +189,9 @@ namespace LeanCloud.Realtime {
}
///
- /// 按 key 降序
+ /// The descending order by the value corresponding to key.
///
- ///
+ /// Multi-field sorting is supported with comma.
///
public LCIMConversationQuery OrderByDescending(string key) {
Condition.OrderByDescending(key);
@@ -199,7 +199,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 拉取 key 的完整对象
+ /// Includes nested LCObject for the provided key.
///
///
///
@@ -209,7 +209,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 包含 key
+ /// Restricts the keys of the LCObject returned.
///
///
///
@@ -219,7 +219,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 跳过
+ /// Sets the amount of results to skip before returning any results.
///
///
///
@@ -229,7 +229,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 限制数量
+ /// Sets the limit of the number of results to return.
///
///
///
@@ -243,7 +243,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 查找
+ /// Retrieves a list of LCObjects matching this query.
///
///
public async Task> Find() {
diff --git a/Realtime/Realtime/Conversation/LCIMServiceConversation.cs b/Realtime/Realtime/Conversation/LCIMServiceConversation.cs
index 93e8da2..b2159a6 100644
--- a/Realtime/Realtime/Conversation/LCIMServiceConversation.cs
+++ b/Realtime/Realtime/Conversation/LCIMServiceConversation.cs
@@ -2,9 +2,6 @@
using System.Threading.Tasks;
namespace LeanCloud.Realtime {
- ///
- /// 系统对话
- ///
public class LCIMServiceConversation : LCIMConversation {
public LCIMServiceConversation(LCIMClient client) : base(client) {
}
diff --git a/Realtime/Realtime/Conversation/LCIMTemporaryConversation.cs b/Realtime/Realtime/Conversation/LCIMTemporaryConversation.cs
index 01f20ad..3fc19c3 100644
--- a/Realtime/Realtime/Conversation/LCIMTemporaryConversation.cs
+++ b/Realtime/Realtime/Conversation/LCIMTemporaryConversation.cs
@@ -1,20 +1,11 @@
using System;
namespace LeanCloud.Realtime {
- ///
- /// 临时对话
- ///
public class LCIMTemporaryConversation : LCIMConversation {
- ///
- /// 过期时间
- ///
public DateTime ExpiredAt {
get;
}
- ///
- /// 是否过期
- ///
public bool IsExpired {
get {
return DateTime.Now > ExpiredAt;
diff --git a/Realtime/Realtime/Internal/Connection/LCConnection.cs b/Realtime/Realtime/Internal/Connection/LCConnection.cs
index 1e7732a..6073502 100644
--- a/Realtime/Realtime/Internal/Connection/LCConnection.cs
+++ b/Realtime/Realtime/Internal/Connection/LCConnection.cs
@@ -10,7 +10,7 @@ using LeanCloud.Realtime.Internal.Protocol;
namespace LeanCloud.Realtime.Internal.Connection {
///
- /// 连接层,只与数据协议相关
+ /// Connection layer
///
public class LCConnection {
// 请求/应答比对,即 I 相等
@@ -24,53 +24,29 @@ namespace LeanCloud.Realtime.Internal.Connection {
}
}
- ///
- /// 连接状态
- ///
enum State {
///
- /// 初始状态
+ /// Initial
///
None,
- ///
- /// 连接中
- ///
Connecting,
///
- /// 连接成功
+ /// Connected
///
Open,
- ///
- /// 关闭的
- ///
Closed,
}
- ///
- /// 发送超时
- ///
private const int SEND_TIMEOUT = 10000;
- ///
- /// 最大重连次数,超过后重置 Router 缓存后再次尝试重连
- ///
private const int MAX_RECONNECT_TIMES = 10;
- ///
- /// 重连间隔
- ///
private const int RECONNECT_INTERVAL = 10000;
- ///
- /// 子协议
- ///
private const string SUB_PROTOCOL = "lc.protobuf2.3";
internal string id;
- ///
- /// 请求回调缓存
- ///
private readonly Dictionary> requestToResponses;
private int requestI = 1;
@@ -134,11 +110,6 @@ namespace LeanCloud.Realtime.Internal.Connection {
}
}
- ///
- /// 发送请求,会在收到应答后返回
- ///
- ///
- ///
internal async Task SendRequest(GenericCommand request) {
if (IsIdempotentCommand(request)) {
GenericCommand sendingReq = requestToResponses.Keys.FirstOrDefault(item => {
@@ -166,11 +137,6 @@ namespace LeanCloud.Realtime.Internal.Connection {
return await tcs.Task;
}
- ///
- /// 发送命令
- ///
- ///
- ///
internal async Task SendCommand(GenericCommand command) {
LCLogger.Debug($"{id} => {FormatCommand(command)}");
byte[] bytes = command.ToByteArray();
@@ -182,9 +148,6 @@ namespace LeanCloud.Realtime.Internal.Connection {
}
}
- ///
- /// 断开连接
- ///
private void Disconnect() {
state = State.Closed;
heartBeat.Stop();
@@ -194,10 +157,6 @@ namespace LeanCloud.Realtime.Internal.Connection {
}
}
- ///
- /// 消息接收回调
- ///
- ///
private void OnMessage(byte[] bytes) {
try {
GenericCommand command = GenericCommand.Parser.ParseFrom(bytes);
@@ -241,18 +200,11 @@ namespace LeanCloud.Realtime.Internal.Connection {
}
}
- ///
- /// 连接断开回调
- ///
private void OnDisconnect() {
Disconnect();
_ = Reconnect();
}
- ///
- /// 重置连接
- ///
- ///
internal void Reset() {
Disconnect();
// 重新创建连接组件
@@ -318,16 +270,10 @@ namespace LeanCloud.Realtime.Internal.Connection {
}
}
- ///
- /// 暂停连接
- ///
internal void Pause() {
Disconnect();
}
- ///
- /// 恢复连接
- ///
internal void Resume() {
_ = Reconnect();
}
diff --git a/Realtime/Realtime/Internal/Connection/LCHeartBeat.cs b/Realtime/Realtime/Internal/Connection/LCHeartBeat.cs
index bd62a3b..d82e53e 100644
--- a/Realtime/Realtime/Internal/Connection/LCHeartBeat.cs
+++ b/Realtime/Realtime/Internal/Connection/LCHeartBeat.cs
@@ -5,10 +5,11 @@ using LeanCloud.Realtime.Internal.Protocol;
namespace LeanCloud.Realtime.Internal.Connection {
///
- /// 心跳控制器,由于 .Net Standard 2.0 不支持发送 ping frame,所以需要发送逻辑心跳
- /// 1. 每隔 180s 发送 ping 包
- /// 2. 接收到 pong 包刷新上次 pong 时间
- /// 3. 每隔 180s 检测 pong 包间隔,超过 360s 则认为断开
+ /// Heartbeat controller is needed because .Net Standard 2.0 does not support sending ping frame.
+ /// 1. Ping every 180 seconds.
+ /// 2. Receiving a pong packet will refresh the pong interval.
+ /// 3. Check pong interval every 180 seconds.
+ /// If the interval is greater than 360 seconds, the connection is considered disconnected.
///
public class LCHeartBeat {
private const int PING_INTERVAL = 180 * 1000;
@@ -32,9 +33,6 @@ namespace LeanCloud.Realtime.Internal.Connection {
this.connection = connection;
}
- ///
- /// 启动心跳
- ///
public void Start() {
running = true;
heartBeatCTS = new CancellationTokenSource();
@@ -92,9 +90,6 @@ namespace LeanCloud.Realtime.Internal.Connection {
lastPongTime = DateTimeOffset.Now;
}
- ///
- /// 停止心跳监听
- ///
public void Stop() {
running = false;
heartBeatCTS.Cancel();
diff --git a/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs b/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs
index b2f288f..fac4d49 100644
--- a/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs
+++ b/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs
@@ -16,17 +16,6 @@ namespace LeanCloud.Realtime.Internal.Controller {
#region 内部接口
- ///
- /// 创建对话
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
internal async Task CreateConv(
IEnumerable members = null,
string name = null,
@@ -94,11 +83,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
return conversation;
}
- ///
- /// 查询成员数量
- ///
- ///
- ///
+>
internal async Task GetMembersCount(string convId) {
ConvCommand conv = new ConvCommand {
Cid = convId,
@@ -109,12 +94,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
return response.ConvMessage.Count;
}
- ///
- /// 更新对话属性
- ///
- ///
- ///
- ///
+
internal async Task> UpdateInfo(string convId,
Dictionary attributes) {
ConvCommand conv = new ConvCommand {
@@ -135,12 +115,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
return null;
}
- ///
- /// 增加成员
- ///
- ///
- ///
- ///
+>
internal async Task AddMembers(string convId,
IEnumerable clientIds) {
ConvCommand conv = new ConvCommand {
@@ -165,12 +140,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
return NewPartiallySuccessResult(allowedIds, errors);
}
- ///
- /// 移除成员
- ///
- ///
- ///
- ///
+
internal async Task RemoveMembers(string convId,
IEnumerable removeIds) {
ConvCommand conv = new ConvCommand {
@@ -195,11 +165,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
return NewPartiallySuccessResult(allowedIds, errors);
}
- ///
- /// 静音
- ///
- ///
- ///
+
internal async Task Mute(string convId) {
ConvCommand conv = new ConvCommand {
Cid = convId
@@ -209,11 +175,6 @@ namespace LeanCloud.Realtime.Internal.Controller {
await Connection.SendRequest(request);
}
- ///
- /// 解除静音
- ///
- ///
- ///
internal async Task Unmute(string convId) {
ConvCommand conv = new ConvCommand {
Cid = convId
@@ -223,12 +184,6 @@ namespace LeanCloud.Realtime.Internal.Controller {
await Connection.SendRequest(request);
}
- ///
- /// 禁言用户
- ///
- ///
- ///
- ///
internal async Task MuteMembers(string convId,
IEnumerable clientIds) {
if (clientIds == null || clientIds.Count() == 0) {
@@ -244,12 +199,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
return NewPartiallySuccessResult(response.ConvMessage.AllowedPids, response.ConvMessage.FailedPids);
}
- ///
- /// 解除用户禁言
- ///
- ///
- ///
- ///
+
internal async Task UnmuteMembers(string convId,
IEnumerable clientIds) {
ConvCommand conv = new ConvCommand {
@@ -262,12 +212,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
return NewPartiallySuccessResult(response.ConvMessage.AllowedPids, response.ConvMessage.FailedPids);
}
- ///
- /// 拉黑成员
- ///
- ///
- ///
- ///
+
internal async Task BlockMembers(string convId,
IEnumerable clientIds) {
BlacklistCommand blacklist = new BlacklistCommand {
@@ -289,12 +234,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
return NewPartiallySuccessResult(response.BlacklistMessage.AllowedPids, response.BlacklistMessage.FailedPids);
}
- ///
- /// 移除成员黑名单
- ///
- ///
- ///
- ///
+>
internal async Task UnblockMembers(string convId,
IEnumerable clientIds) {
BlacklistCommand blacklist = new BlacklistCommand {
@@ -316,13 +256,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
return NewPartiallySuccessResult(response.BlacklistMessage.AllowedPids, response.BlacklistMessage.FailedPids);
}
- ///
- /// 修改成员角色
- ///
- ///
- ///
- ///
- ///
+>
internal async Task UpdateMemberRole(string convId,
string memberId,
string role) {
@@ -339,11 +273,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
GenericCommand response = await Connection.SendRequest(request);
}
- ///
- /// 获取所有成员角色
- ///
- ///
- ///
+
internal async Task> GetAllMemberInfo(string convId) {
string path = "classes/_ConversationMemberInfo";
string token = await Client.SessionController.GetToken();
@@ -367,13 +297,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
}).ToList().AsReadOnly();
}
- ///
- /// 查询禁言成员
- ///
- ///
- ///
- ///
- ///
+
internal async Task QueryMutedMembers(string convId,
int limit = 10,
string next = null) {
@@ -392,14 +316,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
Next = response.ConvMessage.Next
};
}
-
- ///
- /// 查询黑名单用户
- ///
- ///
- ///
- ///
- ///
+>
internal async Task QueryBlockedMembers(string convId,
int limit = 10,
string next = null) {
@@ -419,11 +336,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
};
}
- ///
- /// 查找
- ///
- ///
- ///
+
internal async Task> Find(LCIMConversationQuery query) {
GenericCommand command = new GenericCommand {
Cmd = CommandType.Conv,
@@ -468,11 +381,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
}).ToList().AsReadOnly();
}
- ///
- /// 获取临时对话
- ///
- ///
- ///
+
internal async Task> GetTemporaryConversations(IEnumerable convIds) {
if (convIds == null || convIds.Count() == 0) {
return null;
@@ -493,11 +402,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
return convList;
}
- ///
- /// 拉取对话接收/已读情况
- ///
- ///
- ///
+
internal async Task FetchReciptTimestamp(string convId) {
ConvCommand convCommand = new ConvCommand {
Cid = convId
@@ -511,12 +416,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
conversation.LastReadTimestamp = convCommand.MaxReadTimestamp;
}
- ///
- /// 获取在线成员
- ///
- ///
- ///
- ///
+
internal async Task> GetOnlineMembers(string convId,
int limit) {
ConvCommand conv = new ConvCommand {
@@ -531,11 +431,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
return members;
}
- ///
- /// 查询是否订阅
- ///
- ///
- ///
+
internal async Task CheckSubscription(string convId) {
ConvCommand conv = new ConvCommand();
conv.Cids.Add(convId);
@@ -666,21 +562,13 @@ namespace LeanCloud.Realtime.Internal.Controller {
}
}
- ///
- /// 当前用户加入会话
- ///
- ///
- ///
+
private async Task OnJoined(ConvCommand convMessage) {
LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid);
Client.OnInvited?.Invoke(conversation, convMessage.InitBy);
}
- ///
- /// 有用户加入会话
- ///
- ///
- ///
+
private async Task OnMembersJoined(ConvCommand convMessage) {
LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid);
ReadOnlyCollection joinedIds = new ReadOnlyCollection(convMessage.M);
@@ -688,11 +576,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
Client.OnMembersJoined?.Invoke(conversation, joinedIds, convMessage.InitBy);
}
- ///
- /// 当前用户离开会话
- ///
- ///
- ///
+
private async Task OnLeft(ConvCommand convMessage) {
LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid);
// 从内存中清除对话
@@ -700,11 +584,6 @@ namespace LeanCloud.Realtime.Internal.Controller {
Client.OnKicked?.Invoke(conversation, convMessage.InitBy);
}
- ///
- /// 有成员离开会话
- ///
- ///
- ///
private async Task OnMemberLeft(ConvCommand convMessage) {
LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid);
ReadOnlyCollection leftIdList = new ReadOnlyCollection(convMessage.M);
@@ -712,31 +591,19 @@ namespace LeanCloud.Realtime.Internal.Controller {
Client.OnMembersLeft?.Invoke(conversation, leftIdList, convMessage.InitBy);
}
- ///
- /// 当前用户被禁言
- ///
- ///
- ///
+
private async Task OnMuted(ConvCommand convMessage) {
LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid);
Client.OnMuted?.Invoke(conversation, convMessage.InitBy);
}
- ///
- /// 当前用户被解除禁言
- ///
- ///
- ///
+
private async Task OnUnmuted(ConvCommand convMessage) {
LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid);
Client.OnUnmuted?.Invoke(conversation, convMessage.InitBy);
}
- ///
- /// 有成员被禁言
- ///
- ///
- ///
+
private async Task OnMembersMuted(ConvCommand convMessage) {
LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid);
ReadOnlyCollection mutedMemberIds = new ReadOnlyCollection(convMessage.M);
@@ -744,11 +611,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
Client.OnMembersMuted?.Invoke(conversation, mutedMemberIds, convMessage.InitBy);
}
- ///
- /// 有成员被解除禁言
- ///
- ///
- ///
+
private async Task OnMembersUnmuted(ConvCommand convMessage) {
LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid);
ReadOnlyCollection unmutedMemberIds = new ReadOnlyCollection(convMessage.M);
@@ -756,53 +619,31 @@ namespace LeanCloud.Realtime.Internal.Controller {
Client.OnMembersUnmuted?.Invoke(conversation, unmutedMemberIds, convMessage.InitBy);
}
- ///
- /// 当前用户被拉黑
- ///
- ///
- ///
private async Task OnBlocked(ConvCommand convMessage) {
LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid);
Client.OnBlocked?.Invoke(conversation, convMessage.InitBy);
}
- ///
- /// 当前用户被解除黑名单
- ///
- ///
- ///
+
private async Task OnUnblocked(ConvCommand convMessage) {
LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid);
Client.OnUnblocked?.Invoke(conversation, convMessage.InitBy);
}
- ///
- /// 有用户被拉黑
- ///
- ///
- ///
+
private async Task OnMembersBlocked(ConvCommand convMessage) {
LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid);
ReadOnlyCollection blockedMemberIds = convMessage.M.ToList().AsReadOnly();
Client.OnMembersBlocked?.Invoke(conversation, blockedMemberIds, convMessage.InitBy);
}
- ///
- /// 有用户被移除黑名单
- ///
- ///
- ///
+
private async Task OnMembersUnblocked(ConvCommand convMessage) {
LCIMConversation conversation = await Client.GetOrQueryConversation(convMessage.Cid);
ReadOnlyCollection unblockedMemberIds = convMessage.M.ToList().AsReadOnly();
Client.OnMembersUnblocked?.Invoke(conversation, unblockedMemberIds, convMessage.InitBy);
}
- ///
- /// 对话属性被修改
- ///
- ///
- ///
private async Task OnPropertiesUpdated(ConvCommand conv) {
LCIMConversation conversation = await Client.GetOrQueryConversation(conv.Cid);
Dictionary updatedAttr = JsonConvert.DeserializeObject>(conv.AttrModified.Data,
@@ -814,11 +655,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
conv.InitBy);
}
- ///
- /// 用户角色被修改
- ///
- ///
- ///
+
private async Task OnMemberInfoChanged(ConvCommand conv) {
LCIMConversation conversation = await Client.GetOrQueryConversation(conv.Cid);
ConvMemberInfo memberInfo = conv.Info;
diff --git a/Realtime/Realtime/Internal/Controller/LCIMMessageController.cs b/Realtime/Realtime/Internal/Controller/LCIMMessageController.cs
index cec51cc..97a2dcd 100644
--- a/Realtime/Realtime/Internal/Controller/LCIMMessageController.cs
+++ b/Realtime/Realtime/Internal/Controller/LCIMMessageController.cs
@@ -14,12 +14,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
#region 内部接口
- ///
- /// 发送消息
- ///
- ///
- ///
- ///
+
internal async Task Send(string convId,
LCIMMessage message,
LCIMMessageSendOptions options) {
@@ -74,12 +69,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
return message;
}
- ///
- /// 撤回消息
- ///
- ///
- ///
- ///
+
internal async Task RecallMessage(string convId,
LCIMMessage message) {
PatchCommand patch = new PatchCommand();
@@ -97,13 +87,6 @@ namespace LeanCloud.Realtime.Internal.Controller {
await Connection.SendRequest(request);
}
- ///
- /// 修改消息
- ///
- ///
- ///
- ///
- ///
internal async Task UpdateMessage(string convId,
LCIMMessage oldMessage,
LCIMMessage newMessage) {
@@ -133,16 +116,6 @@ namespace LeanCloud.Realtime.Internal.Controller {
GenericCommand response = await Connection.SendRequest(request);
}
- ///
- /// 查询消息
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
internal async Task> QueryMessages(string convId,
LCIMMessageQueryEndpoint start = null,
LCIMMessageQueryEndpoint end = null,
@@ -197,12 +170,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
}).ToList().AsReadOnly();
}
- ///
- /// 确认收到消息
- ///
- ///
- ///
- ///
+
internal async Task Ack(string convId,
string msgId) {
AckCommand ack = new AckCommand {
@@ -214,12 +182,6 @@ namespace LeanCloud.Realtime.Internal.Controller {
await Connection.SendCommand(command);
}
- ///
- /// 确认已读消息
- ///
- ///
- ///
- ///
internal async Task Read(string convId,
LCIMMessage msg) {
ReadCommand read = new ReadCommand();
@@ -248,11 +210,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
}
}
- ///
- /// 接收消息事件
- ///
- ///
- ///
+
private async Task OnMessaage(GenericCommand notification) {
DirectCommand direct = notification.DirectMessage;
// 反序列化消息
@@ -288,11 +246,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
Client.OnMessage?.Invoke(conversation, message);
}
- ///
- /// 消息被修改事件
- ///
- ///
- ///
+
private async Task OnMessagePatched(GenericCommand notification) {
PatchCommand patchMessage = notification.PatchMessage;
foreach (PatchItem patch in patchMessage.Patches) {
@@ -320,11 +274,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
}
}
- ///
- /// 消息回执事件
- ///
- ///
- ///
+
private async Task OnMessageReceipt(GenericCommand notification) {
RcpCommand rcp = notification.RcpMessage;
string convId = rcp.Cid;
diff --git a/Realtime/Realtime/Internal/Controller/LCIMSessionController.cs b/Realtime/Realtime/Internal/Controller/LCIMSessionController.cs
index 81e1861..8fd3072 100644
--- a/Realtime/Realtime/Internal/Controller/LCIMSessionController.cs
+++ b/Realtime/Realtime/Internal/Controller/LCIMSessionController.cs
@@ -15,10 +15,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
#region 内部接口
- ///
- /// 打开会话
- ///
- ///
+
internal async Task Open(bool force) {
await Connection.Connect();
@@ -32,10 +29,6 @@ namespace LeanCloud.Realtime.Internal.Controller {
Connection.Register(Client);
}
- ///
- /// 重新打开会话,重连时调用
- ///
- ///
internal async Task Reopen() {
SessionCommand session = await NewSessionCommand();
session.R = true;
@@ -49,20 +42,14 @@ namespace LeanCloud.Realtime.Internal.Controller {
}
}
- ///
- /// 关闭会话
- ///
- ///
+
internal async Task Close() {
GenericCommand request = NewCommand(CommandType.Session, OpType.Close);
await Connection.SendRequest(request);
Connection.UnRegister(Client);
}
- ///
- /// 获取可用 token
- ///
- ///
+
internal async Task GetToken() {
if (IsExpired) {
await Refresh();
@@ -134,11 +121,7 @@ namespace LeanCloud.Realtime.Internal.Controller {
}
}
- ///
- /// 被关闭
- ///
- ///
- ///
+
private void OnClosed(SessionCommand session) {
int code = session.Code;
string reason = session.Reason;
diff --git a/Realtime/Realtime/Internal/Router/LCRTMRouter.cs b/Realtime/Realtime/Internal/Router/LCRTMRouter.cs
index c1207b0..b818823 100644
--- a/Realtime/Realtime/Internal/Router/LCRTMRouter.cs
+++ b/Realtime/Realtime/Internal/Router/LCRTMRouter.cs
@@ -5,13 +5,8 @@ using LeanCloud.Common;
using Newtonsoft.Json;
namespace LeanCloud.Realtime.Internal.Router {
- ///
- /// RTM Router
- ///
+
public class LCRTMRouter {
- ///
- /// 请求超时
- ///
private const int REQUEST_TIMEOUT = 10000;
private LCRTMServer rtmServer;
@@ -19,10 +14,6 @@ namespace LeanCloud.Realtime.Internal.Router {
public LCRTMRouter() {
}
- ///
- /// 获取服务器地址
- ///
- ///
public async Task GetServer() {
if (rtmServer == null || !rtmServer.IsValid) {
await Fetch();
diff --git a/Realtime/Realtime/Internal/WebSocket/LCWebSocketClient.cs b/Realtime/Realtime/Internal/WebSocket/LCWebSocketClient.cs
index ab4277f..1a6e5e4 100644
--- a/Realtime/Realtime/Internal/WebSocket/LCWebSocketClient.cs
+++ b/Realtime/Realtime/Internal/WebSocket/LCWebSocketClient.cs
@@ -4,40 +4,20 @@ using System.Net.WebSockets;
using System.Text;
namespace LeanCloud.Realtime.Internal.WebSocket {
- ///
- /// WebSocket 客户端,负责底层连接和事件,只与通信协议相关
- ///
public class LCWebSocketClient {
// .net standard 2.0 好像在拼合 Frame 时有 bug,所以将这个值调整大一些
private const int RECV_BUFFER_SIZE = 1024 * 5;
- ///
- /// 关闭超时
- ///
private const int CLOSE_TIMEOUT = 5000;
- ///
- /// 连接超时
- ///
private const int CONNECT_TIMEOUT = 10000;
- ///
- /// 消息事件
- ///
public Action OnMessage;
- ///
- /// 连接关闭
- ///
public Action OnClose;
private ClientWebSocket ws;
- ///
- /// 连接指定 ws 服务器
- ///
- ///
- ///
public async Task Connect(string server,
string subProtocol = null) {
LCLogger.Debug($"Connecting WebSocket: {server}");
@@ -57,10 +37,6 @@ namespace LeanCloud.Realtime.Internal.WebSocket {
}
}
- ///
- /// 主动关闭连接
- ///
- ///
public async Task Close() {
LCLogger.Debug("Closing WebSocket");
OnMessage = null;
@@ -80,11 +56,6 @@ namespace LeanCloud.Realtime.Internal.WebSocket {
}
}
- ///
- /// 发送二进制数据
- ///
- ///
- ///
public async Task Send(byte[] data,
WebSocketMessageType messageType = WebSocketMessageType.Binary) {
ArraySegment bytes = new ArraySegment(data);
@@ -102,19 +73,10 @@ namespace LeanCloud.Realtime.Internal.WebSocket {
}
}
- ///
- /// 发送文本数据
- ///
- ///
- ///
public async Task Send(string text) {
await Send(Encoding.UTF8.GetBytes(text), WebSocketMessageType.Text);
}
- ///
- /// 接收数据
- ///
- ///
private async Task StartReceive() {
byte[] buffer = new byte[RECV_BUFFER_SIZE];
try {
diff --git a/Realtime/Realtime/LCIMClient.cs b/Realtime/Realtime/LCIMClient.cs
index 6e08d3c..f88f296 100644
--- a/Realtime/Realtime/LCIMClient.cs
+++ b/Realtime/Realtime/LCIMClient.cs
@@ -8,39 +8,31 @@ using LeanCloud.Realtime.Internal.Protocol;
using LeanCloud.Realtime.Internal.Controller;
namespace LeanCloud.Realtime {
- ///
- /// 通信客户端
- ///
+
public class LCIMClient {
///
- /// 对话缓存
+ /// Conversation cache
///
internal Dictionary ConversationDict;
///
- /// 用户 Id
+ /// Client Id
///
public string Id {
get; private set;
}
///
- /// 用户标识
+ /// Client tag
///
public string Tag {
get; private set;
}
- ///
- /// 设备 Id
- ///
public string DeviceId {
get; private set;
}
- ///
- /// 登录 tokens
- ///
internal string SessionToken {
get; private set;
}
@@ -50,21 +42,22 @@ namespace LeanCloud.Realtime {
#region 连接状态事件
///
- /// 客户端连接断开
+ /// Occurs when the connection is lost.
///
public Action OnPaused {
get; set;
}
///
- /// 客户端连接恢复正常
+ /// Occurs when the connection is recovered.
///
public Action OnResume {
get; set;
}
///
- /// 当前客户端被服务端强行下线
+ /// Occurs when the connection is closed and there will be no auto reconnection.
+ /// Possible causes include there is a single device login conflict or the client has been kicked off by the server.
///
public Action OnClose {
get; set;
@@ -75,92 +68,92 @@ namespace LeanCloud.Realtime {
#region 对话事件
///
- /// 当前用户被加入某个对话的黑名单
+ /// Occurs when the current user is added into the blacklist of a conversation.
///
public Action OnBlocked {
get; set;
}
///
- /// 当用户被解除黑名单
+ /// Occurs when the current user is removed from the blacklist of a conversation.
///
public Action OnUnblocked {
get; set;
}
///
- /// 当前用户在某个对话中被禁言
+ /// Occurs when the current user is muted in a conversation.
///
public Action OnMuted;
///
- /// 当前用户在某个对话中被解除禁言
+ /// Occurs when the current user is unmuted in a conversation.
///
public Action OnUnmuted;
///
- /// 该对话信息被更新
+ /// Occurs when the properties of a conversation are updated.
///
public Action, string> OnConversationInfoUpdated;
///
- /// 当前用户被添加至某个对话
+ /// Occurs when the current user is invited to a conversation.
///
public Action OnInvited {
get; set;
}
///
- /// 当前用户被从某个对话中移除
+ /// Occurs when the current user is kicked from a conversation.
///
public Action OnKicked {
get; set;
}
///
- /// 有用户被添加至某个对话
+ /// Occurs when a user joined a conversation.
///
public Action, string> OnMembersJoined {
get; set;
}
///
- /// 有成员被从某个对话中移除
+ /// Occurs when a user left a conversation.
///
public Action, string> OnMembersLeft {
get; set;
}
///
- /// 有成员被加入某个对话的黑名单
+ /// Occurs when a user is added to the blacklist of a conversation.
///
public Action, string> OnMembersBlocked {
get; set;
}
///
- /// 有成员被移出某个对话的黑名单
+ /// Occurs when a user is removed from the blacklist of a conversation.
///
public Action, string> OnMembersUnblocked {
get; set;
}
///
- /// 有成员在某个对话中被禁言
+ /// Occurs when a user is muted in a conversation.
///
public Action, string> OnMembersMuted {
get; set;
}
///
- /// 有成员被移出某个对话的黑名单
+ /// Occurs when a user is unmuted in a conversation.
///
public Action, string> OnMembersUnmuted {
get; set;
}
///
- /// 有成员的对话信息被更新
+ /// Occurs when the properties of someone are updated.
///
public Action OnMemberInfoUpdated;
@@ -169,56 +162,56 @@ namespace LeanCloud.Realtime {
#region 消息事件
///
- /// 当前用户收到消息
+ /// Occurs when a new message is delivered to a conversation the current user is already in.
///
public Action OnMessage {
get; set;
}
///
- /// 消息被撤回
+ /// Occurs when a message is recalled.
///
public Action OnMessageRecalled {
get; set;
}
///
- /// 消息被修改
+ /// Occurs when a message is updated.
///
public Action OnMessageUpdated {
get; set;
}
///
- /// 消息已送达
+ /// Occurs when a message is delivered.
///
public Action OnMessageDelivered {
get; set;
}
///
- /// 消息已读
+ /// Occurs when a message is read.
///
public Action OnMessageRead {
get; set;
}
///
- /// 未读消息数目更新
+ /// Occurs when the number of unreadMessagesCount is updatded.
///
public Action> OnUnreadMessagesCountUpdated {
get; set;
}
///
- /// 最近分发消息更新
+ /// Occurs when the last delivered message is updated.
///
public Action OnLastDeliveredAtUpdated {
get; set;
}
///
- /// 最近已读消息更新
+ /// Occurs when the last delivered message is updated.
///
public Action OnLastReadAtUpdated {
get; set;
@@ -289,9 +282,9 @@ namespace LeanCloud.Realtime {
}
///
- /// 登录
+ /// Signing in
///
- /// 是否强制登录
+ /// If this is ture (default value), and single device sign-on is enabled, users already logged in on another device with the same tag will be logged out.
///
public async Task Open(bool force = true) {
try {
@@ -305,7 +298,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 关闭
+ /// Closes the session
///
///
public async Task Close() {
@@ -314,12 +307,14 @@ namespace LeanCloud.Realtime {
}
///
- /// 创建普通对话
+ /// Creates a conversation
///
- ///
- ///
- ///
- ///
+ /// The list of clientIds of participants in this conversation (except the creator)
+ /// The name of this conversation
+ /// Whether this conversation is unique;
+ /// if it is true and an existing conversation contains the same composition of members,
+ /// the existing conversation will be reused, otherwise a new conversation will be created.
+ /// Custom attributes of this conversation
///
public async Task CreateConversation(
IEnumerable members,
@@ -333,10 +328,10 @@ namespace LeanCloud.Realtime {
}
///
- /// 创建聊天室
+ /// Creates a chatroom
///
- ///
- ///
+ /// The name of this chatroom
+ /// Custom attributes of this chatroom
///
public async Task CreateChatRoom(
string name,
@@ -348,11 +343,11 @@ namespace LeanCloud.Realtime {
}
///
- /// 创建临时对话
+ /// Creates a temporary conversation
///
- ///
- ///
- ///
+ /// The list of clientIds of participants in this temporary conversation (except the creator)
+ /// TTL of this temporary conversation
+ /// Custom attributes of this temporary conversation
///
public async Task CreateTemporaryConversation(
IEnumerable members,
@@ -366,9 +361,9 @@ namespace LeanCloud.Realtime {
}
///
- /// 根据 id 获取对话
+ /// Queries a conversation based on its id.
///
- ///
+ /// objectId
///
public async Task GetConversation(string id) {
if (string.IsNullOrEmpty(id)) {
@@ -392,9 +387,9 @@ namespace LeanCloud.Realtime {
}
///
- /// 获取某些特定的对话
+ /// Queries conversations based on their ids.
///
- ///
+ /// objectId list
///
public async Task> GetConversationList(IEnumerable ids) {
if (ids == null || ids.Count() == 0) {
@@ -423,7 +418,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 获取对话查询对象
+ /// Constructs a conversation query.
///
///
public LCIMConversationQuery GetQuery() {
diff --git a/Realtime/Realtime/LCRealtime.cs b/Realtime/Realtime/LCRealtime.cs
index 612650e..08d7c19 100644
--- a/Realtime/Realtime/LCRealtime.cs
+++ b/Realtime/Realtime/LCRealtime.cs
@@ -4,14 +4,14 @@ using LeanCloud.Realtime.Internal.Connection;
namespace LeanCloud.Realtime {
public class LCRealtime {
///
- /// RTM 服务中,每个 app 对应一条连接
+ /// Every application uses a connection.
///
private static readonly Dictionary appToConnections = new Dictionary();
///
- /// 获取对应的 Connection
+ /// Gets the connection.
///
- ///
+ /// App ID of the application
///
internal static LCConnection GetConnection(string appId) {
if (appToConnections.TryGetValue(appId, out LCConnection connection)) {
@@ -23,15 +23,15 @@ namespace LeanCloud.Realtime {
}
///
- /// 移除 Connection
+ /// Removes the connection.
///
- ///
+ /// The LCConnection to remove
internal static void RemoveConnection(LCConnection connection) {
appToConnections.Remove(connection.id);
}
///
- /// 主动断开所有 RTM 连接
+ /// Disconnects all.
///
public static void Pause() {
foreach (LCConnection connection in appToConnections.Values) {
@@ -40,7 +40,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 主动恢复所有 RTM 连接
+ /// Reconnects all.
///
public static void Resume() {
foreach (LCConnection connection in appToConnections.Values) {
diff --git a/Realtime/Realtime/Message/LCIMAudioMessage.cs b/Realtime/Realtime/Message/LCIMAudioMessage.cs
index 830459f..cf80bec 100644
--- a/Realtime/Realtime/Message/LCIMAudioMessage.cs
+++ b/Realtime/Realtime/Message/LCIMAudioMessage.cs
@@ -2,13 +2,7 @@
using LeanCloud.Storage;
namespace LeanCloud.Realtime {
- ///
- /// 音频消息
- ///
public class LCIMAudioMessage : LCIMFileMessage {
- ///
- /// 时长
- ///
public double Duration {
get; private set;
}
diff --git a/Realtime/Realtime/Message/LCIMBinaryMessage.cs b/Realtime/Realtime/Message/LCIMBinaryMessage.cs
index d8d76fa..d0af326 100644
--- a/Realtime/Realtime/Message/LCIMBinaryMessage.cs
+++ b/Realtime/Realtime/Message/LCIMBinaryMessage.cs
@@ -1,11 +1,5 @@
namespace LeanCloud.Realtime {
- ///
- /// 二进制消息
- ///
public class LCIMBinaryMessage : LCIMMessage {
- ///
- /// 消息数据
- ///
public byte[] Data {
get; internal set;
}
diff --git a/Realtime/Realtime/Message/LCIMFileMessage.cs b/Realtime/Realtime/Message/LCIMFileMessage.cs
index 0cdf93c..0f9340a 100644
--- a/Realtime/Realtime/Message/LCIMFileMessage.cs
+++ b/Realtime/Realtime/Message/LCIMFileMessage.cs
@@ -4,33 +4,27 @@ using System.Collections.Generic;
using LeanCloud.Storage;
namespace LeanCloud.Realtime {
- ///
- /// 文件消息
- ///
public class LCIMFileMessage : LCIMTextMessage {
- ///
- /// 文件
- ///
public LCFile File {
get; set;
}
///
- /// 文件大小
+ /// The size of the file in bytes.
///
public int Size {
get; private set;
}
///
- /// 文件扩展名
+ /// The format extension of the file.
///
public string Format {
get; private set;
}
///
- /// 文件链接
+ /// The URL of the file.
///
public string Url {
get {
diff --git a/Realtime/Realtime/Message/LCIMImageMessage.cs b/Realtime/Realtime/Message/LCIMImageMessage.cs
index 5bc4144..07679ed 100644
--- a/Realtime/Realtime/Message/LCIMImageMessage.cs
+++ b/Realtime/Realtime/Message/LCIMImageMessage.cs
@@ -2,20 +2,11 @@
using LeanCloud.Storage;
namespace LeanCloud.Realtime {
- ///
- /// 图像消息
- ///
public class LCIMImageMessage : LCIMFileMessage {
- ///
- /// 图像宽度
- ///
public int Width {
get; private set;
}
- ///
- /// 图像高度
- ///
public int Height {
get; private set;
}
diff --git a/Realtime/Realtime/Message/LCIMLocationMessage.cs b/Realtime/Realtime/Message/LCIMLocationMessage.cs
index e4454ca..44fde3b 100644
--- a/Realtime/Realtime/Message/LCIMLocationMessage.cs
+++ b/Realtime/Realtime/Message/LCIMLocationMessage.cs
@@ -3,13 +3,7 @@ using System.Collections.Generic;
using LeanCloud.Storage;
namespace LeanCloud.Realtime {
- ///
- /// 位置消息
- ///
public class LCIMLocationMessage : LCIMTextMessage {
- ///
- /// 位置
- ///
public LCGeoPoint Location {
get; set;
}
diff --git a/Realtime/Realtime/Message/LCIMMessage.cs b/Realtime/Realtime/Message/LCIMMessage.cs
index e62fbcb..bdf91b0 100644
--- a/Realtime/Realtime/Message/LCIMMessage.cs
+++ b/Realtime/Realtime/Message/LCIMMessage.cs
@@ -3,39 +3,39 @@ using System.Collections.Generic;
namespace LeanCloud.Realtime {
///
- /// 消息基类
+ /// The base class of message.
///
public abstract class LCIMMessage {
///
- /// 消息所在对话 Id
+ /// The conversation ID this message belongs to.
///
public string ConversationId {
get; set;
}
///
- /// 消息 Id
+ /// The ID of this message.
///
public string Id {
get; set;
}
///
- /// 发送者 Id
+ /// The ID of the client who sends this message.
///
public string FromClientId {
get; set;
}
///
- /// 发送时间戳
+ /// The timestamp of this message.
///
public long SentTimestamp {
get; internal set;
}
///
- /// 发送时间
+ /// The sending date of this message.
///
public DateTime SentAt {
get {
@@ -52,7 +52,7 @@ namespace LeanCloud.Realtime {
}
///
- /// 送达时间
+ /// The delivered date of this message.
///
public DateTime DeliveredAt {
get {
@@ -62,14 +62,14 @@ namespace LeanCloud.Realtime {
}
///
- /// 已读时间戳
+ /// The timestamp when this message has been read by others.
///
public long ReadTimestamp {
get; internal set;
}
///
- /// 已读时间
+ /// When this message has been read by others.
///
public DateTime ReadAt {
get {
@@ -79,14 +79,14 @@ namespace LeanCloud.Realtime {
}
///
- /// 修改时间戳
+ /// The timestamp when this message is updated.
///
public long PatchedTimestamp {
get; internal set;
}
///
- /// 修改时间
+ /// When this message is updated.
///
public DateTime PatchedAt {
get {
@@ -96,28 +96,28 @@ namespace LeanCloud.Realtime {
}
///
- /// 提醒成员 Id 列表
+ /// The members in the conversation mentioned by this message.
///
public List MentionIdList {
get; set;
}
///
- /// 是否提醒所有人
+ /// Whether all members in the conversation are mentioned by this message.
///
public bool MentionAll {
get; set;
}
///
- /// 是否提醒当前用户
+ /// Whether the current user has been mentioned in this message.
///
public bool Mentioned {
get; internal set;
}
///
- /// 是否是暂态消息
+ /// Indicates whether this message is transient.
///
public bool IsTransient {
get; internal set;
diff --git a/Realtime/Realtime/Message/LCIMMessageSendOptions.cs b/Realtime/Realtime/Message/LCIMMessageSendOptions.cs
index 4e61efd..194864b 100644
--- a/Realtime/Realtime/Message/LCIMMessageSendOptions.cs
+++ b/Realtime/Realtime/Message/LCIMMessageSendOptions.cs
@@ -2,7 +2,7 @@
namespace LeanCloud.Realtime {
///
- /// 消息优先级
+ /// The priority for sending messages in chatroom.
///
public enum LCIMMessagePriority {
Hight = 1,
@@ -11,32 +11,33 @@ namespace LeanCloud.Realtime {
}
///
- /// 发送消息选项
+ /// The options for sending message.
///
public class LCIMMessageSendOptions {
///
- /// 是否作为暂态消息发送
+ /// Whether this is a transient message.
///
public bool Transient {
get; set;
}
///
- /// 是否需要消息回执,仅在普通对话中有效
+ /// Whether receipts are needed, only for normal conversations.
///
public bool Receipt {
get; set;
}
///
- /// 是否作为遗愿消息发送
+ /// Whether this is a will message,
+ /// which will be sent automatically when a user goes offline unexpectedly.
///
public bool Will {
get; set;
}
///
- /// 消息优先级,仅在暂态对话中有效
+ /// The priority for sending messages in chatroom.
///
public LCIMMessagePriority Priority {
get; set;
diff --git a/Realtime/Realtime/Message/LCIMRecalledMessage.cs b/Realtime/Realtime/Message/LCIMRecalledMessage.cs
index 352e585..60b3211 100644
--- a/Realtime/Realtime/Message/LCIMRecalledMessage.cs
+++ b/Realtime/Realtime/Message/LCIMRecalledMessage.cs
@@ -1,7 +1,7 @@
namespace LeanCloud.Realtime {
///
- /// 撤回消息
+ /// The recall message, i.e. a message to recall a previous sent message.
///
public class LCIMRecalledMessage : LCIMTypedMessage {
public LCIMRecalledMessage() {
diff --git a/Realtime/Realtime/Message/LCIMTextMessage.cs b/Realtime/Realtime/Message/LCIMTextMessage.cs
index 2b0fb56..e9cee7b 100644
--- a/Realtime/Realtime/Message/LCIMTextMessage.cs
+++ b/Realtime/Realtime/Message/LCIMTextMessage.cs
@@ -1,13 +1,7 @@
using System.Collections.Generic;
namespace LeanCloud.Realtime {
- ///
- /// 文本消息
- ///
public class LCIMTextMessage : LCIMTypedMessage {
- ///
- /// 文本
- ///
public string Text {
get; set;
}
diff --git a/Realtime/Realtime/Message/LCIMTypedMessage.cs b/Realtime/Realtime/Message/LCIMTypedMessage.cs
index 39cbb79..95ccb59 100644
--- a/Realtime/Realtime/Message/LCIMTypedMessage.cs
+++ b/Realtime/Realtime/Message/LCIMTypedMessage.cs
@@ -6,40 +6,19 @@ using LeanCloud.Common;
namespace LeanCloud.Realtime {
///
- /// 已知类型消息
+ /// Known message types.
///
public class LCIMTypedMessage : LCIMMessage {
- ///
- /// 文本消息
- ///
public const int TextMessageType = -1;
- ///
- /// 图像消息
- ///
public const int ImageMessageType = -2;
- ///
- /// 音频消息
- ///
public const int AudioMessageType = -3;
- ///
- /// 视频消息
- ///
public const int VideoMessageType = -4;
- ///
- /// 位置消息
- ///
public const int LocationMessageType = -5;
- ///
- /// 文件消息
- ///
public const int FileMessageType = -6;
- ///
- /// 撤回消息
- ///
public const int RecalledMessageType = -127;
///
- /// 保留字段
+ /// Preserved fields.
///
protected const string MessageTypeKey = "_lctype";
protected const string MessageAttributesKey = "_lcattrs";
@@ -64,19 +43,16 @@ namespace LeanCloud.Realtime {
private Dictionary customProperties;
///
- /// 完整的消息数据
+ /// Complete data of message.
///
protected Dictionary data = new Dictionary();
- ///
- /// 消息类型
- ///
public virtual int MessageType {
get; private set;
}
///
- /// 消息属性访问
+ /// Gets message attributes.
///
///
///
@@ -146,7 +122,7 @@ namespace LeanCloud.Realtime {
};
///
- /// 注册自定义类型消息
+ /// Registers a custom message type.
///
///
///
diff --git a/Realtime/Realtime/Message/LCIMVideoMessage.cs b/Realtime/Realtime/Message/LCIMVideoMessage.cs
index fb86337..c49ce9f 100644
--- a/Realtime/Realtime/Message/LCIMVideoMessage.cs
+++ b/Realtime/Realtime/Message/LCIMVideoMessage.cs
@@ -2,27 +2,15 @@
using LeanCloud.Storage;
namespace LeanCloud.Realtime {
- ///
- /// 视频消息
- ///
public class LCIMVideoMessage : LCIMFileMessage {
- ///
- /// 宽度
- ///
public int Width {
get; private set;
}
- ///
- /// 高度
- ///
public int Height {
get; private set;
}
- ///
- /// 时长
- ///
public double Duration {
get; private set;
}
diff --git a/Realtime/Realtime/Result/LCIMOperationFailure.cs b/Realtime/Realtime/Result/LCIMOperationFailure.cs
index 73780e1..1f95229 100644
--- a/Realtime/Realtime/Result/LCIMOperationFailure.cs
+++ b/Realtime/Realtime/Result/LCIMOperationFailure.cs
@@ -1,27 +1,15 @@
using System.Collections.Generic;
namespace LeanCloud.Realtime {
- ///
- /// 操作失败
- ///
public class LCIMOperationFailure {
- ///
- /// 失败码
- ///
public int Code {
get; set;
}
- ///
- /// 失败原因
- ///
public string Reason {
get; set;
}
- ///
- /// 失败数据
- ///
public List IdList {
get; set;
}
diff --git a/Realtime/Realtime/Result/LCIMPageResult.cs b/Realtime/Realtime/Result/LCIMPageResult.cs
index c0879b5..a559db6 100644
--- a/Realtime/Realtime/Result/LCIMPageResult.cs
+++ b/Realtime/Realtime/Result/LCIMPageResult.cs
@@ -1,20 +1,11 @@
using System.Collections.ObjectModel;
namespace LeanCloud.Realtime {
- ///
- /// 查询分页结果
- ///
public class LCIMPageResult {
- ///
- /// 当前分页数据集
- ///
public ReadOnlyCollection Results {
get; internal set;
}
- ///
- /// 下次请求的数据
- ///
public string Next {
get; internal set;
}
diff --git a/Realtime/Realtime/Result/LCIMPartiallySuccessResult.cs b/Realtime/Realtime/Result/LCIMPartiallySuccessResult.cs
index e91f336..86f61e5 100644
--- a/Realtime/Realtime/Result/LCIMPartiallySuccessResult.cs
+++ b/Realtime/Realtime/Result/LCIMPartiallySuccessResult.cs
@@ -1,20 +1,11 @@
using System.Collections.Generic;
namespace LeanCloud.Realtime {
- ///
- /// 部分成功结果
- ///
public class LCIMPartiallySuccessResult {
- ///
- /// 成功数据集
- ///
public List SuccessfulClientIdList {
get; internal set;
}
- ///
- /// 失败原因
- ///
public List FailureList {
get; internal set;
}
diff --git a/Realtime/Realtime/Signature/ILCIMSignatureFactory.cs b/Realtime/Realtime/Signature/ILCIMSignatureFactory.cs
index 4690302..47efa91 100644
--- a/Realtime/Realtime/Signature/ILCIMSignatureFactory.cs
+++ b/Realtime/Realtime/Signature/ILCIMSignatureFactory.cs
@@ -2,41 +2,13 @@
using System.Threading.Tasks;
namespace LeanCloud.Realtime {
- ///
- /// 签名工程接口
- ///
public interface ILCIMSignatureFactory {
- ///
- /// 登录签名
- ///
- ///
- ///
Task CreateConnectSignature(string clientId);
- ///
- /// 创建开启对话签名
- ///
- ///
Task CreateStartConversationSignature(string clientId, IEnumerable memberIds);
- ///
- /// 创建会话相关签名
- ///
- ///
- ///
- ///
- ///
- ///
Task CreateConversationSignature(string conversationId, string clientId, IEnumerable memberIds, string action);
- ///
- /// 创建黑名单相关签名
- ///
- ///
- ///
- ///
- ///
- ///
Task CreateBlacklistSignature(string conversationId, string clientId, IEnumerable memberIds, string action);
}
}
diff --git a/Realtime/Realtime/Signature/LCIMSignature.cs b/Realtime/Realtime/Signature/LCIMSignature.cs
index 815d246..416b86d 100644
--- a/Realtime/Realtime/Signature/LCIMSignature.cs
+++ b/Realtime/Realtime/Signature/LCIMSignature.cs
@@ -1,24 +1,15 @@
namespace LeanCloud.Realtime {
- ///
- /// 签名数据
- ///
public class LCIMSignature {
- ///
- /// 签名
- ///
public string Signature {
get; set;
}
- ///
- /// 时间戳
- ///
public long Timestamp {
get; set;
}
///
- /// 随机字符串
+ /// A random string.
///
public string Nonce {
get; set;
diff --git a/Realtime/Realtime/Signature/LCIMSignatureAction.cs b/Realtime/Realtime/Signature/LCIMSignatureAction.cs
index 013ed5d..fdb15ae 100644
--- a/Realtime/Realtime/Signature/LCIMSignatureAction.cs
+++ b/Realtime/Realtime/Signature/LCIMSignatureAction.cs
@@ -1,36 +1,18 @@
namespace LeanCloud.Realtime {
///
- /// 支持签名的动作
+ /// Actions supporting signatures.
///
public static class LCIMSignatureAction {
- ///
- /// 邀请
- ///
public const string Invite = "invite";
- ///
- /// 踢出
- ///
public const string Kick = "kick";
- ///
- /// 用户拉黑对话
- ///
public const string ClientBlockConversations = "client-block-conversations";
- ///
- /// 用户解除拉黑对话
- ///
public const string ClientUnblockConversations = "client-unblock-conversations";
- ///
- /// 对话拉黑用户
- ///
public const string ConversationBlockClients = "conversation-block-clients";
- ///
- /// 对话解除拉黑用户
- ///
public const string ConversationUnblockClients = "conversation-unblock-clients";
}
}
diff --git a/Sample/LiveQueryApp/SingleThreadSynchronizationContext.cs b/Sample/LiveQueryApp/SingleThreadSynchronizationContext.cs
index d881cca..c1d059e 100644
--- a/Sample/LiveQueryApp/SingleThreadSynchronizationContext.cs
+++ b/Sample/LiveQueryApp/SingleThreadSynchronizationContext.cs
@@ -6,7 +6,7 @@ using System.Collections.Generic;
namespace LiveQueryApp {
///
- /// 单线程环境,用于控制台应用 await 返回
+ /// Mimics UI thread under .Net console.
///
public class SingleThreadSynchronizationContext : SynchronizationContext {
private readonly BlockingCollection> queue = new BlockingCollection>();
diff --git a/Sample/RealtimeApp/SingleThreadSynchronizationContext.cs b/Sample/RealtimeApp/SingleThreadSynchronizationContext.cs
index fdfb2c9..fb75c27 100644
--- a/Sample/RealtimeApp/SingleThreadSynchronizationContext.cs
+++ b/Sample/RealtimeApp/SingleThreadSynchronizationContext.cs
@@ -6,7 +6,7 @@ using System.Collections.Generic;
namespace RealtimeApp {
///
- /// 单线程环境,用于控制台应用 await 返回
+ /// Mimics UI thread under .Net console.
///
public class SingleThreadSynchronizationContext : SynchronizationContext {
private readonly BlockingCollection> queue = new BlockingCollection>();
diff --git a/Storage/Storage/LCACL.cs b/Storage/Storage/LCACL.cs
index 024c48f..d07e5c0 100644
--- a/Storage/Storage/LCACL.cs
+++ b/Storage/Storage/LCACL.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace LeanCloud.Storage {
///
- /// 访问控制类
+ /// LeanCloud Access Control Lists.
///
public class LCACL {
const string PublicKey = "*";
diff --git a/Storage/Storage/LCApplication.cs b/Storage/Storage/LCApplication.cs
index be49ceb..846315a 100644
--- a/Storage/Storage/LCApplication.cs
+++ b/Storage/Storage/LCApplication.cs
@@ -5,7 +5,7 @@ using LeanCloud.Storage.Internal.Http;
namespace LeanCloud {
///
- /// LeanCloud 全局接口
+ /// LeanCloud Application
///
public class LCApplication {
// SDK 版本号,用于 User-Agent 统计
diff --git a/Storage/Storage/LCCaptchaClient.cs b/Storage/Storage/LCCaptchaClient.cs
index 968c730..f18d040 100644
--- a/Storage/Storage/LCCaptchaClient.cs
+++ b/Storage/Storage/LCCaptchaClient.cs
@@ -4,7 +4,7 @@ using System.Threading.Tasks;
namespace LeanCloud.Storage {
///
- /// 验证码
+ /// An image CAPTCHA to prevent SMS abuse.
///
public class LCCapture {
public string Url {
@@ -17,14 +17,14 @@ namespace LeanCloud.Storage {
}
///
- /// 验证码工具类
+ /// Requests a CAPTCHA image and sends the verification code.
///
public static class LCCaptchaClient {
///
- /// 请求验证码
+ /// Requests a CAPTCHA image from LeanCloud.
///
- /// 验证码图片宽度
- /// 验证码图片高度
+ /// Width of the CAPTCHA image.
+ /// Height of the CAPTCHA image.
///
public static async Task RequestCaptcha(int width = 82,
int height = 39) {
@@ -41,10 +41,10 @@ namespace LeanCloud.Storage {
}
///
- /// 验证
+ /// Sends the code to LeanCloud for verification.
///
- ///
- ///
+ /// entered by the user
+ /// for LeanCloud to recognize which CAPTCHA to verify
///
public static async Task VerifyCaptcha(string code,
string token) {
diff --git a/Storage/Storage/LCCloud.cs b/Storage/Storage/LCCloud.cs
index ed8fc2f..a1cbfd1 100644
--- a/Storage/Storage/LCCloud.cs
+++ b/Storage/Storage/LCCloud.cs
@@ -4,24 +4,24 @@ using LeanCloud.Storage.Internal.Codec;
namespace LeanCloud.Storage {
///
- /// 云引擎
+ /// LeanEngine
///
public static class LCCloud {
private const string PRODUCTION_KEY = "X-LC-Prod";
///
- /// 是否是生产环境,默认为 true
+ /// Whether using production environment (default) or staging environment.
///
public static bool IsProduction {
get; set;
} = true;
///
- /// 调用云函数
+ /// Invokes a cloud function.
///
- ///
- ///
- /// 返回类型为 Dictionary
+ /// Cloud function name.
+ /// Parameters of cloud function.
+ /// Dictionary or List
public static async Task> Run(string name,
Dictionary parameters = null) {
string path = $"functions/{name}";
@@ -36,11 +36,11 @@ namespace LeanCloud.Storage {
}
///
- /// 调用 RPC 云函数
+ /// Invokes a cloud function as a remote procedure call.
///
- ///
- ///
- /// 返回类型为 LCObject 容器类型
+ /// Cloud function name.
+ /// Parameters of cloud function.
+ /// LCObject, List, or Map.
public static async Task