重构NetManager支持MessagePair,新增TSRPCWsClient。

This commit is contained in:
janing
2025-12-18 13:25:04 +08:00
parent c12e439add
commit fb940452db
41 changed files with 976 additions and 681 deletions

View File

@@ -0,0 +1,19 @@
import { MsgReqSend } from '../../../Shared/protocols/MsgReqSend';
import { MsgResSend } from '../../../Shared/protocols/MsgResSend';
import { MessagePair } from '../MessagePairBase';
/**
* 发送消息对实现
*/
export class SendMessagePair extends MessagePair<MsgReqSend, MsgResSend> {
readonly requestName = 'ReqSend';
readonly responseName = 'ResSend';
isValidRequest(msg: any): msg is MsgReqSend {
return msg && typeof msg.content === 'string';
}
isValidResponse(msg: any): msg is MsgResSend {
return msg && msg.time instanceof Date;
}
}