feat: minor feat client & add TODO

This commit is contained in:
pk5ls20 2024-10-14 18:03:30 +08:00
parent 397c2cf5f0
commit 325dff5735
No known key found for this signature in database
GPG Key ID: 6370ED7A169F493A
3 changed files with 6 additions and 4 deletions

View File

@ -96,7 +96,7 @@ export class PacketClient {
}
}
async registerCallback(trace_id: string, type: string, callback: (json: RecvPacketData) => Promise<void>): Promise<void> {
private async registerCallback(trace_id: string, type: string, callback: (json: RecvPacketData) => Promise<void>): Promise<void> {
this.cb.put(createHash('md5').update(trace_id).digest('hex') + type, callback);
}
@ -113,7 +113,7 @@ export class PacketClient {
this.websocket.send(JSON.stringify(initMessage));
}
async sendCommand(cmd: string, data: string, trace_id: string, rsp: boolean = false, timeout: number = 5000, sendcb: (json: RecvPacketData) => void = () => {
private async sendCommand(cmd: string, data: string, trace_id: string, rsp: boolean = false, timeout: number = 5000, sendcb: (json: RecvPacketData) => void = () => {
}): Promise<RecvPacketData> {
return new Promise<RecvPacketData>((resolve, reject) => {
if (!this.isConnected || !this.websocket) {

View File

@ -1,3 +1,4 @@
// TODO: refactor with NapProto
import { MessageType, BinaryReader, ScalarType } from '@protobuf-ts/runtime';
export const BodyInner = new MessageType("BodyInner", [

View File

@ -1,3 +1,4 @@
// TODO: refactor with NapProto
import { MessageType, BinaryReader, ScalarType, RepeatType } from '@protobuf-ts/runtime';
export const LikeDetail = new MessageType("likeDetail", [