2

我在节点 js 中编写了 websocket 客户端,它将以 protobuff 编码格式从服务器接收消息。

数据.proto

message test1{
    required int32 id = 1;
}

message test2{
    required int32 id = 1; // 1
    required string tok = 2;
}

message test4 { 
    required int32 id = 1; // 3
    repeated string asdf = 2;
}

websocket 服务器将递归地发送不同的消息test1test2test3。由于传入的消息是编码的,我无法找到需要调用哪个原始消息结构来解码消息。有没有办法在调用解码之前找到原始消息类型?

4

0 回答 0