byte[] Heartbeat() { var hearbeat = new ZtLiveCsHeartbeat { ClientTimestampMs = DateTimeOffset.Now.ToUnixTimeMilliseconds(), Sequence = HeartbeatSeqId++, }; var cmd = new ZtLiveCsCmd { CmdType = GlobalCommand.HEARTBEAT, Payload = hearbeat.ToByteString(), Ticket = Tickets[TicketIndex], LiveId = LiveId, }; var payload = new UpstreamPayload { Command = Command.GLOBAL_COMMAND, SeqId = SeqId, RetryCount = RetryCount, PayloadData = cmd.ToByteString(), SubBiz = SubBiz, }; var body = payload.ToByteString(); var header = new PacketHeader { AppId = AppId, Uid = UserId, InstanceId = InstanceId, DecodedPayloadLen = body.Length, EncryptionMode = PacketHeader.Types.EncryptionMode.KEncryptionSessionKey, SeqId = SeqId++, Kpn = KPN }; return(Encode(header, body)); }
byte[] EnterRoom() { var request = new ZtLiveCsEnterRoom { EnterRoomAttach = EnterRoomAttach, ClientLiveSdkVersion = ClientLiveSdkVersion }; var cmd = new ZtLiveCsCmd { CmdType = GlobalCommand.ENTER_ROOM, Payload = request.ToByteString(), Ticket = Tickets[TicketIndex], LiveId = LiveId, }; var payload = new UpstreamPayload { Command = Command.GLOBAL_COMMAND, SeqId = SeqId++, RetryCount = RetryCount, PayloadData = cmd.ToByteString(), SubBiz = SubBiz, }; var body = payload.ToByteString(); var header = new PacketHeader { AppId = AppId, Uid = UserId, InstanceId = InstanceId, DecodedPayloadLen = body.Length, EncryptionMode = PacketHeader.Types.EncryptionMode.KEncryptionSessionKey, SeqId = HeaderSeqId++, Kpn = KPN }; return(Encode(header, body)); }