csharp-sdk-upm/Realtime/Internal/Router/LCRTMServer.cs

40 lines
843 B
C#

using System;
using Newtonsoft.Json;
namespace LeanCloud.Realtime.Internal.Router {
internal class LCRTMServer {
[JsonProperty("groupId")]
internal string GroupId {
get; set;
}
[JsonProperty("groupUrl")]
internal string GroupUrl {
get; set;
}
[JsonProperty("server")]
internal string Server {
get; set;
}
[JsonProperty("secondary")]
internal string Secondary {
get; set;
}
[JsonProperty("ttl")]
internal int Ttl {
get; set;
}
DateTimeOffset createdAt;
internal LCRTMServer() {
createdAt = DateTimeOffset.Now;
}
internal bool IsValid => DateTimeOffset.Now < createdAt + TimeSpan.FromSeconds(Ttl);
}
}