k8w / tsrpc

A TypeScript RPC framework, with runtime type checking and serialization, support both HTTP and WebSocket. It is very suitable for website / APP / games, and absolutely comfortable to full-stack TypeScript developers.
MIT License
1.9k stars 203 forks source link

协议接口增加新属性兼容问题 #17

Closed harochen75 closed 2 years ago

harochen75 commented 2 years ago

原先协议接口属性: export interface ReqLogin{ username: string }

后因为需求变更,需要增加字段:客户端类型 export interface ReqLogin{ username: string, clientType:number }

旧客户端未更新协议之前,访问新的服务器,会提示fail:Missing required property clientType 怎么做到兼容的处理呢?

k8w commented 2 years ago

新字段设为可选 clientType?: number 或者蓝绿发布到不同 URL

harochen75 commented 2 years ago

嗯,找到文档说明。 文档地址:https://tsrpc.cn/docs/server/deployment/proto-change.html