2020-03-25 16:42:30 +08:00
|
|
|
|
using System.Threading.Tasks;
|
2020-04-28 17:02:52 +08:00
|
|
|
|
using LeanCloud.Realtime.Internal.Protocol;
|
2020-04-10 16:32:33 +08:00
|
|
|
|
using LeanCloud.Realtime.Internal.Connection;
|
2020-03-25 16:42:30 +08:00
|
|
|
|
|
|
|
|
|
namespace LeanCloud.Realtime.Internal.Controller {
|
|
|
|
|
internal abstract class LCIMController {
|
|
|
|
|
protected LCIMClient Client {
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal LCIMController(LCIMClient client) {
|
|
|
|
|
Client = client;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal abstract Task OnNotification(GenericCommand notification);
|
|
|
|
|
|
2020-04-10 16:32:33 +08:00
|
|
|
|
protected LCConnection Connection {
|
2020-03-25 16:42:30 +08:00
|
|
|
|
get {
|
|
|
|
|
return Client.Connection;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-14 14:51:14 +08:00
|
|
|
|
|
|
|
|
|
protected GenericCommand NewCommand(CommandType cmd, OpType op) {
|
|
|
|
|
GenericCommand command = NewCommand(cmd);
|
|
|
|
|
command.Op = op;
|
|
|
|
|
return command;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected GenericCommand NewCommand(CommandType cmd) {
|
|
|
|
|
return new GenericCommand {
|
|
|
|
|
Cmd = cmd,
|
|
|
|
|
AppId = LCApplication.AppId,
|
|
|
|
|
PeerId = Client.Id,
|
|
|
|
|
};
|
|
|
|
|
}
|
2020-03-25 16:42:30 +08:00
|
|
|
|
}
|
|
|
|
|
}
|